CBSE Class 12 Computer Science Question 9 of 79

Table Creation and Data Manipulation Commands — Question 3

Back to all questions
3
Question

Question 3

What is the role of UNIQUE constraint ? How is PRIMARY KEY constraint different from UNIQUE constraint ?

Answer

UNIQUE constraint ensures that no two rows have the same value in the specified column(s).
There are differences between UNIQUE and PRIMARY KEY constraints. Though both ensure unique values for each row in a column, but UNIQUE allows NULL values whereas PRIMARY KEY does not. Also, there can exist multiple columns with UNIQUE constraints in a table, but there can exist only one column or one combination with PRIMARY KEY constraint.