Foreign Keys
Information about different entity types is stored in different tables, so you must have a way to navigate between tables. The relational model provides a mechanism called a foreign key to associate two tables. A foreign key has these characteristics:
It’s a column (or group of columns) in a table whose values relate to, or reference, values in some other table.
It ensures that rows in one table have corresponding rows in another table.
The table that contains the foreign key is the referencing or child table. The other table is the referenced or parent table.
A foreign key establishes a direct relationship to the parent table’s primary key (or any candidate key), so foreign-key values are restricted to parent-key values that already ...
Get SQL: Visual QuickStart Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.