-->

Difference between Primary key and Unique Constraints

Posted by Admin on
What is the difference between primary key and unique constraints?

Both primary key and unique key enforces uniqueness of the column on which they are defined . 
1)But by default , a primary key creates a clustered indexes on the column , whereas unique creates a non clustered index by default .
2) Also, primary key does not allow NULL values , but unique key allows NULL values .
3) There can be more than one unique key for a table but there can not be more than one primary key for a table .

If you don't know what is clustered or non-clustered indexes then See This  







No comments:

Post a Comment