Primary key
Also called: PK
A column (usually id) whose value uniquely identifies each row in a table.
Definition
No two rows can share a primary key and it can't be empty. Other tables point to a row by storing its primary key, which is how orders know which user placed them.
In practice
Order 1007 is the only row in orders with id = 1007, even if two orders have the same total and date.
Learn it in context
Lessons that use this term.
Related terms
- Foreign keyA column that points to the primary key of a row in another table, like orders.user_id → users.id.
- Table (database)A set of rows and columns in a database that holds one kind of thing, like users or orders.
- DatabaseAn organized store of an app's data, such as users, orders and payments, kept on a server.