Foreign Keys, Referential Integrity
Foreign key : Set of fields in one relation that is used to `refer’ to a tuple in another (or the same) relation. (Must correspond to primary key of the second relation.) Like a `logical pointer’.
E.g. sid is a foreign key referring to Students:
- Enrolled(sid: string, cid: string, grade: string)
- If all foreign key constraints are enforced, referential integrity is achieved, i.e., no dangling references.
- Can you name a data model w/o referential integrity?