Keys are what make a database relational — they uniquely identify rows and link tables together.
The Relational Model
Tables, rows, columns and keys — the foundation of SQL.
Tap or hover a part to learn more.
One kind of thing.
A relational database stores data in tables (relations). Each table holds one kind of entity — Customers, Orders, Products — like a well-defined spreadsheet.
Check your understanding
1. What makes a database 'relational'?
2. What kind of language is SQL?
Keep learning
The essentials
- A primary key uniquely identifies each row (e.g. customer_id) — unique and never null.
- A foreign key references a primary key in another table, creating a relationship and enforcing referential integrity (you can't reference a customer that doesn't exist).
- Relationship types: one-to-one, one-to-many (the most common — one customer, many orders) and many-to-many (resolved with a junction table).
