AI engineering glossary · SQL databases
What is PK (primary key)?
Primary key (also called PK): A column, or set of columns, whose values uniquely identify each row in a table and can never be NULL. The database enforces this and usually builds an index on it, so looking up a row by key is fast. Other tables refer to rows through it.
Primary key: an example
In a customers table, customer_id is the primary key: no two customers share one, and every customer has one.
Related terms
More SQL databases terms
- Query optimizer
- RANK and DENSE_RANK
- Recursive CTE
- Referential integrity
- Relational algebra
- Relational database
- Replication
- Row
Where you learn it
Primary key is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.