What is difference between UNIQUE and PRIMARY KEY constraints?
A table can have only one PRIMARY KEY whereas there can be any number of UNIQUE keys. The columns that compose PK are automatically define NOT NULL, whereas a column that compose a UNIQUE is not automatically defined to be mandatory must also specify the column is NOT NULL.
RE: What is difference between UNIQUE and PRIMARY KEY ...
Primary key wont accept null values and a table can have only one primary key for a column. Unique key accepts null values.A table can have any number of unique keys.
RE: What is difference between UNIQUE and PRIMARY KEY constraints?
A table can have only one PRIMARY KEY where as can have numerous UNIQUE KEY . A PRIMARY KEY is a unique KEY with the extra constraint that all key columns must be defined as NOT NULL. But unique key column can contain null value only once. If UNIQUE KEY is defined on more than one column then null values can be in the table by unique combination of those columns. Another difference is that PRIMARY KEY constraints enforces clustered indexing where as UNIQUE KEY constrains are nonclustered indexes.