Each table has a primary key

Each table in a relational database may or may not have a primary key. The primary key is a column, or set of columns, that allows each row in the table to be uniquely identified. No two rows may have the same value of a primary key.

You can select a primary key from all of the available columns. It is good practice to keep your primary key for each table as compact as possible. If possible, the primary key should be an unsigned integer data type, rather than char or varchar.

Examples

In a table holding information about employees, the primary key may be an ID number assigned to each employee.

In the sample database, the table of sales order items has the following columns:

In order to identify a particular item, both the ID and the line ID are required. The primary key is made up of both these columns.