Foreign Key
noun
say it: “FOR-in KEE” /ˈfɔːrɪn kiː/
A column whose values must match the primary key of another table, linking the two, such as Orders.CustomerID.
What is Foreign Key in a relational database?
Foreign Key — Columns whose values must match a referenced unique or primary key, subject to NULL rules.
CREATE TABLE purchase_order (
order_id INTEGER PRIMARY KEY,
customer_id INTEGER REFERENCES customer (customer_id)
);
In a sentence
- “CustomerID in Orders is a foreign key that points to the customer who placed the order.”
Level: Novice · More Database terms at this level
Updated