|
Example: a relation
+-------+------------+---------------+----------+-----+ | 12345 | John Doe | 123 My Ln | 123-4567 | 3.5 | +-------+------------+---------------+----------+-----+ | 22222 | James Bond | 10 Downing St | 777-7777 | 3.7 | <--- 1 "tuple" +-------+------------+---------------+----------+-----+ | 56789 | Jane Doe | 321 Your Way | 876-5678 | 3.8 | +-------+------------+---------------+----------+-----+ |
|
Schematically:
|
|
Mathematically speaking:
A set of attribute SK is a
superkey
if and only if:
|
|
I.e., a key is a minimal superkey.
|
|
Once you have chosen the primary key for some relation, you must use that primary key throughout the database (or else, you database career life will be very miserable)
|
ID in GradeReport is a foreign key:
|
CID in GradeReport is also a foreign key:
|