Name:

Quiz 8

Regarding Reading 8.

  1. What are the four primary "integrity" types we care about?
  2. Say you want to make sure that the values in an integer column are always greater than 0. What specific kind of constraint would you use, and is this an example of domain integrity or entity integrity?

  3. What is the difference between a foreign key and a foreign key constraint?
  4. Only recently has SQLite provided foreign key constraints. If you had an application that used an older version of SQLite, yet you still wanted to maintain domain integrity of all foreign key values. What do you think your program would have to do when, say, deleting a music ALBUM and a TRACK record has the FK album_id? Below is an illustration of some data in the two tables for those entities.

    albums

    id name
    1 Spruce Performs Phish
    2 King Tubby Meets Rockers Uptown

    tracks

    id name length album_id
    1 Dirt 897 1
    2 Waste 442 1
    3 Scent of a Mule 238 1
    4 Keep on Dubbing 512 2