What is a primary key?

A primary key is a field or the combination of fields which uniquely specify a row. The Primary key is a special kind of unique key. Primary key values cannot be NULL. For example, the Social Security Number can be treated as the primary key for any individual.

A primary key in SQL is a field or combination of fields that uniquely identifies each record in a table. It must contain unique values and cannot have NULL (empty) values. The primary key is used to enforce the entity integrity of a relational database by ensuring that each record can be uniquely identified and accessed.

In practical terms, a primary key is often defined when creating a table and is used to establish relationships between tables. It is a critical concept in database design and is fundamental to maintaining the integrity and consistency of the data within a relational database.