Class - 12 CBSE Computer Science — Assertion Reason Type Questions

Assertion. In terms of values allowed in a column, both UNIQUE and PRIMARY KEY constraints are not the same.

Reason. UNIQUE allows NULL value once in the column, but PRIMARY KEY does not.

  1. Both A and R are true and R is the correct explanation of A.
  2. Both A and R are true but R is not the correct explanation of A.
  3. A is true but R is false.
  4. A is false but R is true.

SQL Queries

1 Like

Answer

Both A and R are true and R is the correct explanation of A.

Explanation
The UNIQUE and PRIMARY KEY constraints are similar in that they both ensure uniqueness of values in a column or set of columns. However, they differ in terms of the values they allow, particularly regarding NULL values. UNIQUE allows NULL values, whereas PRIMARY KEY does not.

Answered By

2 Likes