Chapter 9 How to Design a Database


1.     Draw a database diagram for the script file named create_mgs_tables.sql that’s in the mgs_ex_starts folder.

2.     Draw a database diagram for a database that stores information about the downloads that users make.

Each user must have an email address, first name, and last name.

Each user can have one or more downloads.

Each download must have a filename and download date/time.

Each product can be related to one or more downloads.

Each product must have a name.

Chapter 10 How to create tables, sequences,

and indexes


1.   ”  Write script that adds an index to the order_date column in the Orders table in the — schema.

2.     Write script that implements the following design:”

In the Downloads table, the user_id and product_id columns are the foreign keys.

Create these tables in the ex schema.

Create the sequences for the user_id, download_id, and product_id columns.

Include a PL/SQL script to drop the table or sequence if it already exists.

Include any indexes that you think are necessary.

3.     Write script that adds rows to the database that you created in exercise 2.

Add two rows to the Users and Products tables.

Add three rows to the Downloads table: one row for user 1 and product 2; one row for user 2 and product 1; and one row for user 2 and product 2. Use the SYSDATE function to insert the current date into the download_date column.

Use the sequences created in the previous exercise to get the values for the user_id, download_id, and product_id columns.

Write SELECT statement that joins the three tables and retrieves the data from these tables like this:

Sort the results by the email address in descending sequence and the product name in ascending sequence.

"Get 15% discount on your first 3 orders with us"
Use the following coupon

Order Now