Relational Databases: Tables, Keys and Relationships · seed 1 · A4, ink-friendly. The answer key prints on its own page for grown-ups.

Tables, keys and the links between them

Computing · Computer Systems · ages 17-18
Name ______________________   Date ____________
  1. Which value makes a good primary key for a students table?

    • The student's first name
    • A student number given once and never reused
    • The student's favourite colour
  2. In a table of students, what does one row stand for?

    • One student
    • One column
    • One database
  3. A foreign key holds the primary key of a row in another table.

    Circle one:   True   False

  4. Students join clubs, and each club has many members. Which relationship is that?

    • One to one
    • Many to many
    • One to many
  5. Two pupils share the name Amir Khan. Which key stays safe, and why?

    • The name, because it sounds official
    • The birth year, because everyone has one
    • An invented pupil ID, because names repeat
  6. Repeating the club name in every student row keeps the data honest.

    Circle one:   True   False

  7. A designer picks each pupil's email address as the primary key. What is the strongest objection?

    • Emails look ugly in tables
    • Emails are too long to store
    • An address can change, forcing the key and every link to change
  8. A Memberships table has one row per pairing. What should each row hold?

    • The student key plus the club key
    • Only the club name
    • The full details copied in
LightMySky · lightmysky.comW1-mt_i7pZV6H902-s1

Answer key

For grown-ups. Fold this page away before handing over the rest.

Tables, keys and the links between them W1-mt_i7pZV6H902-s1

  1. A student number given once and never reused · The number is unique, never empty, and stays stable over time.
  2. One student · Each row is one thing, and each column is one property of it.
  3. True · That stored key is the pointer that links the two tables.
  4. Many to many · Many students match many clubs, which is many to many.
  5. An invented pupil ID, because names repeat · The invented ID stays unique while the shared name cannot.
  6. False · Copies drift apart on updates, so repetition breeds disagreement.
  7. An address can change, forcing the key and every link to change · A key must stay stable, and addresses do not promise that.
  8. The student key plus the club key · Two foreign keys record the pairing without copying any fact.
Worksheet · LightMySky