
Dbschema set primary key download#
Transcribed image text: Prologue Download the files dbschema.bmp, dbcreate.sql, dbload.sql, and dbdrop.sql included in a section SAMPLE DATABASES on Moodle. To create a sample database, process as script dbcreate.sql. To drop a sample database, process a script dbdrop.sql. To load data into a sample database, process as script dbload.sql. A conceptual schema of a sample database is included in a file dbschema.bmp. It is possible to use a pseudo-column USER to find a name of user you are connected as.

To try it, connect to one of Oracle 19c servers and process the following statement: SELECT USER FROM DUAL The system supposed to return a name of a user you are connected as. No report is expected from the implementations of the actions listed in Prologue. Drop a table In the following example, the declarativetable table was completely removed from the dbschema.xml file. The objective of this laboratory is use database triggers to implement the following access control rule. When creating a new table, remember to generate the dbschemawhitelist.json file. To implement the access control rule listed above we have to extend the structures of a sample database a bit. We add a new relational table to store information about the names of users and the orders created by the users. A Map is a data structure consisting of a set of keys and values in which each key is mapped to a si Queue ( java.util ) A collection designed for holding elements prior to processing. Then, we implement a database trigger that automatically inserts information about a user and about an order key into the new table whenever a new order is added. If an order is deleted then information about a user who earlier created an order to be deleted must be removed from the table together with an order key. In the second step, we implement a database trigger that fires when a new item is added to an order. The trigger must check if a user who attempts to insert the item is the same user who inserted an order into which the new item must be inserted. If such access control rule is violated then the trigger aborts a transaction that attempted to insert a new item. Tasks Task 1 (1 mark) Automatic recording of information in a database In this task we implemented the first part of a system that verifies the following access control rule. An item can be added to an order only by a user who created the order. If you skipped the Prologue section of specification Laboratory 4 then it is recommended to read it now.

Implement SQL script solution1.sql that performs the following actions. If this is not set, the next new rows primary key will have the max value of a. (1) First, the script creates a relational table to store information about a new order key and a name of user who created a new order.

(2) Next, the script creates a database trigger, that automatically inserts into a relational table created in the previous step, a key of a new order and a name of a user who created the order.
