Defining primary keys While not always necessary, most database designers should ensure that each table they create has a primary key for future data manipulation and management.
Any column in the table can be used as a primary key if it meets the following conditions: No two rows have the same primary key value; Each row must have a primary key value (NULL values are not allowed for primary key columns).
Primary key value rules The rules listed here are enforced by MySQL itself.
A primary key is usually defined on a single column of a table, but this is not required, and multiple columns can be used together as primary keys. When multiple columns are used as primary keys, the above conditions must apply to all columns that make up the primary key, and the combination of all column values must be unique (but individual column values may not be). Best habits for primary keys In addition to the rules MySQL enforces, a few generally accepted best habits to adhere to are: do not update values in primary key columns; does not reuse primary key column values; does not use values that may change in primary key columns. (For example, if a name is used as a primary key to identify a vendor, this primary key must be changed when the vendor merges and changes its name.)