Question of the Day Four

Let us continue our question of the day series with day four.

What is the difference between a primary key and a unique key?

The unique key and the primary key designation both enforce that the particular column is unique.  However, the primary key will create a clustered index using that column and a unique key will create a non-clustered index.  This is the fundamental difference in the two.  Another minor difference is that the unique key allows you to have one null value and the primary key does not allow any use of the null value.

Enjoy!

Advertisements

About SQLGator

Florida Gator and Microsoft Data Platform MVP, Star Wars fanatic and is there anything else...oh yeah PS4! I am a geek and SQL Server DBA who dabbles with VMWare, there are other technologies greater than these? Not so fast my friend! I also love to travel to new and exotic places.

Posted on August 6, 2012, in SQL Schoolhouse and tagged . Bookmark the permalink. Leave a comment.

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: