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.
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:
An ID, identifying the order to which the item belongs.
A line ID, identifying each item on any order.
A product ID, identifying the product being ordered.
A quantity, showing how many items were ordered.
A ship date, showing when the order was shipped.
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.