AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Dbschema set primary key1/12/2023 ![]() ![]() 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. When multiple fields are used as a primary key, they are called a. A table can have only one primary key, which may consist of single or multiple fields. A primary key column cannot have NULL values. It is possible to use a pseudo-column USER to find a name of user you are connected as. A primary key is a field in a table which uniquely identifies each row/record in a database table. 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. The objective of this laboratory is use database triggers to implement the following access control rule. To implement the access control rule listed above we have to extend the structures of a sample database a bit. /rebates/&252fmagix-movie-edit-pro-2013-wont-uninstall. We add a new relational table to store information about the names of users and the orders created by the users. If this is not set, the next new rows primary key will have the max value of a. 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. (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. ![]()
0 Comments
Read More
Leave a Reply. |