- Home
- Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion. The PRIMARY KEY can be defined
Class - 12 CBSE Computer Science — Assertion Reason Type Questions
Assertion. The PRIMARY KEY can be defined only once in the CREATE TABLE command.
Reason. If the PRIMARY KEY is a composite key, then it is not defined with the individual columns but at the end of the table definition as a table constraint.
- Both A and R are true and R is the correct explanation of A.
- Both A and R are true but R is not the correct explanation of A.
- A is true but R is false.
- A is false but R is true.
Answer
Both A and R are true and R is the correct explanation of A.
Explanation
In SQL, when we define a table using the CREATE TABLE
command, we can only specify one PRIMARY KEY constraint. This PRIMARY KEY can consist of a single column or multiple columns (composite key). When a PRIMARY KEY is a composite key (consisting of multiple columns), it's not defined with each individual column but rather as a table constraint at the end of the table definition.