Difference between Primary Key and Unique Key

By default, primary key creates clustered index on the column and then enforces the uniqueness of the column whereas the unique key, by default creates a non-clustered index.

Primary Key

  • By default, creates Clustered index
  • Doesn’t allow null
  • Table can have only one Primary Key ( Can include multiple columns together )

Unique Key

  • By default, creates non clustered index
  • Accepts null value
  • Table can have many unique keys
Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Hey, wait!Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

You cannot copy content of this page