Difference Between Primary Key and Unique Key
Every SQL programmer is supposed to have a better knowledge of Primary and Unique key. As I have visited many places and observed this that it’s the basic question being asked. I have decided to share this for those who are fresh and preparing for some kind of interview.
1. Primary key does not accept null values.
2. There is only one primary key in a table.
3. Clustered index is created in Primary key.
4. Primary key allows each row in a table to be uniquely identified and ensures that no duplicate rows exist.
1. Using Unique key, Null values are accepted.
2. More than one unique key can be defined there in a table.
3. Non-Clustered index is created in unique key.
4. Unique key constraint is used to avoid the duplication of key values within the rows of a table.
If you know some more differences, Then comment here or mail me. I will update post.