This is a typical SQL Server interview question and below is the comparison sheet.
Unique Key |
Primary Key |
Unique key can have nulls |
Primary key cannot have nulls. |
In a single table we can create multiple unique keys. |
In a single table we can have only one primary key. |
It creates a non-clustered index by default. |
It created a clustered index by default. |
Both unique keys and primary keys can be referenced by foreign key. |
Below is a nice video which demonstrates the same in a much precise manner...Enjoy.
Asked In: Many Interviews |
Alert Moderator