In a SQL database, the primary key is one or more columns that uniquely identify each row in a table. The primary key is defined by using the PRIMARY KEY constraint when either creating a table or altering a table. Each table can have only one primary key.
The column(s) defined as the primary key inherently have the NOT NULL constraint, meaning they must contain a value. If a table is being altered to add a primary key, any column being defined as the primary key must not contain blank, or NULL, values. If the column does, the primary key constraint cannot be added. Also, in some relational databases, adding a primary key creates a table index, to improve the speed of finding specific rows of data when SQL queries are run against that table.