Translate to Tamil

Earn Money


Best Offers

Amazon Best Offers

Offers

Best Online Offers

Amazon Offers

Earn Money Short URL

Saturday, 7 November 2020

Difference between Primary key and Unique key

What is Primary Key? 

A primary key is used to ensure data in the specific column is unique. It is a column cannot have NULL values


What is Unique Key?

A column with a unique key constraint can only contain unique values – this is the result of the unique key prohibiting duplicate values to be stored inside a column.

Please keep in mind that it’s not mandatory to have a Unique key in a table




Both primary key and unique columns do not accept duplicate values, they can be used for uniquely identifying a record in the table. This means that, for each value in the primary or unique key column, only one record will be returned.


Difference Between Primary Key and Unique Key
Primary Key Foreign Key
It is used to uniquely identify data in the table It is used to maintain relationship between tables
Eve Jackson
It can’t be null It can accept the null values
Two or more rows can’t have same primary key It can carry duplicate value for a foreign key attribute
Primary has clustered index By default, It is not clustered index
Primary key constraint can be defined on temporary tableindex It can’t be defined on temporary tables

No comments:
Write comments

Contact form

Name

Email *

Message *

Infolinks

© 2014