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.

Level: beginnerTopic: SQL databases

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.