Database Tutorial

Course Tutorial Site

Site Admin

Old Oracle Lab 4

without comments

Lab #2: Oracle Assignment

You begin these steps by running the apply_oracle_lab2.sql and seed_oracle_store.sql script. A great starting point for this lab is to review the seed_oracle_store.sql script. You should use the script provided in the downloaded instance or create a script like:

-- Run the prior lab script.
@/home/student/Data/cit225/oracle/lab2/apply_oracle_lab2.sql
@/home/student/Data/cit225/oracle/lib/seed_oracle_store.sql
 
SPOOL apply_oracle_lab4.txt
 
... insert code here ...
 
SPOOL OFF

You should embed the verification queries inside your apply_oracle_lab4.sql script. All foreign key columns in steps 1 through 10 should be populated by subqueries that use the natural key values to discover the surrogate key values. No credit will be given for INSERT statements that use numeric literals for foreign key column values with an exception for both the CREATED_BY and LAST_UPDATED_BY columns.

Step 11 requires you to enter data values into the MEMBER_LAB, CONTACT_LAB, ADDRESS_LAB, STREET_ADDRESS_LAB, TELEPHONE_LAB, RENTAL_LAB, and RENTAL_ITEM_LAB tables. You will insert data into these tables in a specific order. The order depends on the degree that tables are unconstrained or constrained by their foreign key to primary key dependencies. That means you insert into the least dependent table first, which is the MEMBER_LAB table because it only has dependencies on the SYSTEM_USER_LAB and COMMON_LOOKUP_LAB tables. After inserting into the MEMBER_LAB table, you insert customer data into the CONTACT_LAB, ADDRESS_LAB table, STREET_ADDRESS_LAB table, and TELEPHONE_LAB tables. Then, you insert rows in the RENTAL_LAB and RENTAL_ITEM_LAB tables. Step 11 mimics how you would insert values into a series of tables in a dependent relationship from a web application form.

  1. [1 point] Insert two rows into the SYSTEM_USER_LAB table:
  1. [1 point] Insert two rows into the COMMON_LOOKUP_LAB table:
  1. [1 point] Insert two rows into the MEMBER_LAB table:

  1. [1 point] Insert two rows into the CONTACT_LAB table:

  1. [1 point] Insert two rows into the ADDRESS_LAB table::

  1. [1 point] Insert two rows into the STREET_ADDRESS_LAB table:

  1. [1 point] Insert two rows into the TELEPHONE_LAB table:
  1. [1 point] Insert two rows into the RENTAL_LAB table:
  1. [1 points] Insert two rows into the ITEM_LAB table:
  1. [1 point] Insert two rows into the RENTAL_ITEM_LAB table:

  1. [10 points] You insert rows into the a series of tables differently than you insert rows individually. For example, you insert the primary key by using the sequence and .NEXTVAL pseudo column value; and you insert the foreign key by using the sequence and .CURRVAL pseudo column value. You can read more about the .NEXTVAL and .CURRVAL pseudo columns on this web page on automatic numbering.

Written by michaelmclaughlin

May 4th, 2018 at 4:49 pm

Posted in