Databases
What Is a Primary Key?
A primary key is a column, or set of columns, whose value uniquely identifies each row in a database table and can never be empty.
Definition
A primary key is the column that uniquely identifies every row in a table, such as a student ID or an order number. No two rows can share the same value, and the value cannot be NULL.
Each table has at most one primary key, though it can span several columns, which is called a composite key.
How it works
The database builds an index on the primary key, so finding a row by its key is fast. It rejects any insert or update that would create a duplicate.
Other tables point to a row through a foreign key that holds the same value, which is how relational databases link tables together.