The PRIMARY KEY constraint is used to identify each row of data in a table. It doesn't allow NULL values. A table can have only one primary key, which may consist of single or multiple fields.
The UNIQUE KEY constraint ensures that all values in a column are different. It allows only one record to have a NULL value.
Both UNIQUE and PRIMARY KEY constraints provide a guarantee for uniqueness for a column or set of columns.
A PRIMARY KEY constraint automatically has a UNIQUE constraint though.
Several UNIQUE KEY constraints may exist per table, but only one PRIMARY KEY, though.
Ввійдіть щоб вподобати
Ввійдіть щоб прокоментувати