28 December 2011

Difference Between Primary key and Unique key

Difference Between Primary key and Unique key

1.Even though both the primary key and unique key are one or more columns that can uniquely identify a     row in a table, they have some important differences.
2.Most importantly, a table can have only a single primary key while it can have more than one unique key. 
Primary key can be considered as a special case of the unique key. 
3.Another difference is that primary keys have an implicit NOT NULL constraint while the unique key does    not have that constraint. 
4.Therefore, unique key columns may or may not contain NULL values but primary key columns cannot contain NULL values.


No comments:

Post a Comment

Comments Welcome

Consistency level in Azure cosmos db

 Consistency level in Azure cosmos db Azure Cosmos DB offers five well-defined consistency levels to provide developers with the flexibility...