What is difference between primary key and unique key?

They both uniquely identify the tuple in table in Database.

But there is some difference between them as

1. The not null constraint is by default added to primary key, it means, primary key attribute cannot accept null values, Primary Key can’t accept null values but unique key can accept only one null value.

2. We can have only one Primary key in a table but we can have more than one unique key in a table.

3. By default, Primary key is clustered index but By default, Unique key is a unique non-clustered index.

You can learn more in detail about SQL and Database at TCCI, Ahmedabad.

TCCI teach SQL, Database management system, and other programming language in Bopal and satellite , Ahmedabad.

Tririd technologies Pvt Ltd develop web application and Mobile application as per client requirements.

We provide service also in database management and customize software.

For more information about our service.

You can visit us @

Call us @ 8980010210

Leave a Reply

Your email address will not be published. Required fields are marked *