Primary key
|
Unique key
|
Primary key cannot have NULL value.
|
Unique key may have a NULL value.
|
Each table can have only one primary
key.
|
Each table can have more than one
unique key.
|
By default primary key is clustered index.
|
By default unique key is Non- clustered
index.
|
Primary key can be related with
another table’s as a Foreign Key.
|
Unique key cannot be related with
another table’s as a Foreign Key.
|
We can generate ID automatically with
the help of auto increment field.
|
Unique key is not support auto
increment field.
|
Sr. Software Engineer. Having 7+ years of experience in software development. Asp.net, MVC, Json, JavaScript, JQuery, Ajax, CSS, HTML, C, C#, Linq, CanvasJS, Bootstrap, QT, Web API, .Net Core, Node JS.
Wednesday, 28 October 2015
Difference between Primary Key and Unique key in SQL?
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment