Primary keys

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. 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 the demo database, the SalesOrderItems table includes these columns:

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