What Is a Primary Key?

A primary key is a unique identifier used to distinguish a database table entry from other entries. Creating a database table requires assigning at least one column to store the primary keys. A primary key cannot be a null value.

Examples of primary keys include ID numbers for students and employees. Each of these numbers is guaranteed to be uniquely associated with a single entity. A person's name is a bad choice for a primary, because other people likely exist with the same name. To create relationships in a database, primary keys in one table can be used in another as foreign keys. This allows cross-references between tables and eliminates redundant information.