Wednesday, November 24, 2010

[T-SQL] Difference between Primary Key and Unique Key

Primary Key:
  1. Enforce uniqueness of the column on which they are defined.
  2. By default, creates a clustered index on the column.
  3. Doesn't allow NULL value.
  4. A table can have only one primary key.

Unique Key:
  1. Enforce uniqueness of the column on which they are defined.
  2. By default, creates a non-clustered index on the column.
  3. Allows one NULL value.
  4. A table can have multiple unique keys.

No comments:

Post a Comment