Saturday, July 19, 2014

What's the difference between a primary key and a unique key?

Primary key and Unique key enforces uniqueness of the column on which they are defined.The difference between primary key and unique are  below.

  1. Primary Key can't accept null values but where as unique key can accept null value.
  2. By default, Primary key is clustered index but By default, Unique key is a unique non-clustered index.
  3. We can have only one Primary key in a table where as we can have more than one unique key in table.

0 comments:

Post a Comment