Home > Database, SQL Server > What is the difference between Primary and Unique key?

What is the difference between Primary and Unique key?

Both primary and unique keys enforce uniqueness of the column on which they are defined.

By default a primary key creates a clustered index on the column, where as unique key creates a non-clustered index by default.

Another major difference is that, primary key doesn’t allow NULL’s, but unique key can have one NULL value in it’s list of values.

Advertisements
Categories: Database, SQL Server
  1. August 16, 2007 at 11:43 pm

    Thanks for sharing this information. Really is pack with new knowledge. Keep them coming.

  2. Salabha
    September 11, 2007 at 6:20 am

    Clear and to the point explanation.Thanks for sharing this information.

  3. Mayadevi
    May 7, 2008 at 8:45 am

    Thanx for this valuable information

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: