A column in a table (an attribute in an entity) is called a PRIMARY KEY if it uniquely identifies a specific row in a table of multiple rows. A UNIQUE key is a constraint applied on the data of a column. Technically, both are constraints that a column data must satisfy to be added in a table.
- A UNIQUE key means that the column must not contain any duplicate values, meaning all the values in the column must be UNIQUE.
- A column with UNIQUE key can accept NULL as a valid value (for only once in the column)
- A PRIMARY key means that the column must be UNIQUE and no NULL values are allowed (even once)