Sunday, 19 June 2016

Primary Key and Unique Key Difference In Sql Server

6/19/2016 - By Pranav Singh 0

This article will show what exactly difference between primary key and the unique in sql server. In this I will share the information about primary key and unique key and then define.
Primary key:
  •   A primary key on a sql table is a field is uniquely identifies each record in a database table.
  •  Primary key column always contain values.
  • Primary key column value cannot have NULL values.
  • A table can have only one primary key, which may consist of single or multiple fields.
Unique Key:
  • A unique key on a sql table is a field is uniquely identifies each record in a database table.
  • Unique key column can have only one NULL value.

Difference between Primary Key and Unique Key

PRIMARY KEY
UNIQUE KEY
It have uniquely identifies values without null value
It have uniquely identifies values with only one null value
Table column can have only one Primary key in a table
Table column can have only one Unique key in a table.
By default primary key adds a clustered index
By default unique key adds a non-clustered index
Primary key can be made foreign key into another table.
Unique key can be made foreign key into another table in sql server.

About the Author

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Get Updates

Subscribe to our e-mail newsletter to receive updates.

Share This Post

0 comments:

Please let me know your view

Free Ebooks


About Us

We are the group of people who are expertise in different Microsoft technology like Asp.Net,MVC,C#.Net,VB.Net,Windows Application,WPF,jQuery,Javascript,HTML. This blog is designed to share the knowledge.

Contact Us

For writing article in this website please send request by your

GMAIL ID: dotnetpools@gmail.com

Bugs and Suggestions

As we all know that this website is for sharing knowledge and providing proper solution. So while reading the article is you find any bug or if you have any suggestion please mail us at contact@aspdotnet-pools.com.

Partners


Global Classified : Connectseekers.com
© 2014 aspdotnet-pools.com Designed by Bloggertheme9.
back to top