Friday, 22 April 2016

Primary key vs. Unique key


Both enforces uniqueness of the column on which they are defined.

Primary key vs. Unique key
  • Primary key doesn't allow NULL, but unique key allows one NULL only.
  • A table can have multiple unique keys but only one primary key.
  • Primary key creates a clustered index on the column (by default) , where are unique creates a non-clustered index by default.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.