PRIMARY Key and UNIQUE Key enforce the Uniqueness of the values on the column[columns] on which it is defined.
- By Default, UNIQUE Key creates a NON CLUSTERED INDEX while PRIMARY Key creates a CLUSTERED INDEX
- You can create multiple UNIQUE Keys on a table but you can have ONLY One PRIMARY Key on a table.
- PRIMARY Key can be used in Foreign key relationship where as UNIQUE Key can not be used.
- PRIMARY Keys can not have nulls but UNIQUE Key allows null value (But only one null value).
No comments:
Post a Comment