Database Tutorial

Course Tutorial Site

Site Admin

Lab #4 : Inserting Records

with 9 comments

This lab works on developing the students understanding of the syntax to insert data into tables that are constrained by FOREIGN KEY database-level constraints. The lab also tests their ability to solve the best practice for controlling key insertions that support subsequent join operations.

Written by michaelmclaughlin

January 26th, 2010 at 2:34 am

Posted in

9 Responses to 'Lab #4 : Inserting Records'

Subscribe to comments with RSS or TrackBack to 'Lab #4 : Inserting Records'.

  1. CREDIT_CARD_TYPE in member ADDRESS_ID in telephone are missing the foreign key information on this page.

    William Sawyer

    27 Jan 10 at 2:51 pm

  2. Another thing we found: The table definition of MEMBER of this page shows MEMBER with the column MEMBER_TYPE. In the create_store.sql script MEMBER does not have that column.

    William Sawyer

    27 Jan 10 at 5:09 pm

  3. The create_store.sql script doesn’t contain the column, and they should add the column with an ALTER TABLE statement.

    michaelmclaughlin

    28 Jan 10 at 12:42 am

  4. I’ve fixed the table definition for CREDIT_CARD_TYPE, and it now contains a foreign key reference. The other isn’t an error but it was missing a buisness rule. I’ve noted it in the page above. Thanks for the great catch.

    michaelmclaughlin

    28 Jan 10 at 12:47 am

  5. In the CONTACT table MEMBER_ID is referenced incorrectly to common_lookup, It should be referenced to the MEMBER table.

    William Sawyer

    28 Jan 10 at 1:49 pm

  6. Suggestion: middle_name column be renamed to middle_initial in the contact table for clarity.

    Blaine Forbush

    29 Jan 10 at 12:46 pm

  7. Actually in the provided script on I-Learn middle_name is of CHAR(20) just like first_name and last_name so this is appropriate. He just needs to update the table on this website to reflect that. Also the order in the CONTACT table goes first_name, middle_name, then last_name. He has last_name, first_name, middle_name. So for this lab it is better to actually use the script he provides as reference.

    Trent Davis

    29 Jan 10 at 7:03 pm

  8. Great catch. The Oracle script differs from the MySQL script. That wasn’t the intention. I’m fixing the scripts so they’re mirrors. In the meantime, I’ve updated this page to reflect the correct model for the future.

    michaelmclaughlin

    29 Jan 10 at 11:01 pm

  9. “The TELEPHONE table contains an ADDRESS_ID column without a foreign key constraint”

    Should read “without a NOT NULL constraint”

    Andrew Thimmig

    21 Jan 11 at 2:25 pm

Leave a Reply