Difference between Primary Key and Unique key?

Primary Key:
1.Primary Key doesn’t allow NULLs values.
2.There will be only one primary key in a table.
3.Clustered index is created in Primary key.
4.Primary key allows each row in a table to be uniquely identified and ensures that no duplicate rows exist.


Unique Key:
1.Unique Key allows Null value.
2.More than one unique key will be there in a table.
3.Non-Clustered index is created in unique key.
4.Unique key constraint is used to prevent the duplication of key values within the rows of a table and allow null values.

By default Primary Key creates a Clustered Index on the column, where as Unique Key creates a Nonclustered Index by default. Another major difference is that, Primary Key doesn’t allow NULLs, but Unique Key allows one NULL only.We can declare only one primary key in a table
but a table can have multiple unique key