Interview QuestionsCategory: MySQLWhat is the difference between Primary Key and Unique Key?
bestonetechnologies Staff asked 3 years ago

What is the difference between Primary Key and Unique Key?

1 Answers
bestonetechnologies Staff answered 3 years ago

Both PRIMARY and UNIQUE KEY defined for Uniqueness of the column in a table. with below major differences:
a) Primary key doesn’t allow Null Values, however Unique key does allows NULL value.
b) It adds a default clustered index, however Unique key default adds a UNIQUE non-clustered index.
c) There can be only one PRIMARY KEY in a table, but a table can contain multiple UNIQUE Key Column/s.

Your Answer

17 + 19 =