Key Differences Between Primary key and Unique key

 

Key Differences Between Primary key and Unique key

1.    When an attribute is declared as a primary key, it will not accept NULL values. On the other hand, when an attribute is declared as Unique it can accept one NULL value.

2.    A table can have only a primary key whereas there can be multiple unique constraints on a table.

3.    A Clustered index is automatically created when a primary key is defined. In contrast, the Unique key generates the non-clustered index.

 

Comments