Knowledge Maxxing
← Back to topic library
Dev MaxxingIntermediateDatabases60 sec

Primary key

A primary key is a column, or set of columns, whose value uniquely identifies each row in a database table.

Prerequisite: Database table

What matters

Because it uniquely identifies a row, the primary key is what other tables reference to link related data together reliably.

Example

A 'users' table's primary key might be its 'id' column, ensuring no two users can ever share the same id value.

Common misconception

A primary key is not required to be a name or another human-readable field; it's commonly a system-generated id specifically chosen for guaranteed uniqueness.

Recall question

What property must a primary key's value always have across every row?

Keywords and related concepts

primary keyunique identifierdatabaseforeign key

Related topics

Foreign key
Dev MaxxingIntermediate
Database table
Dev MaxxingIntermediate