Exams › GATE › Technical
Given the following statements:
S1: A foreign key declaration can always be replaced by an equivalent check assertion in SQL.
S2: Given the table R (a, b, c) where a and b together form the primary key, the following is a valid table definition.
CREATE TABLE S
a INTEGER,
d INTEGER,
e INTEGER,
PRIMARY KEY (d),
FOREIGN KEY (a) references R
Which one of the following statements is CORRECT ?
- S1 is TRUE and S2 is FALSE.
- Both S1 and S2 are TRUE.
- S1 is FALSE and S2 is TRUE.
- Both S1 and S2 are FALSE.
Correct answer: Both S1 and S2 are FALSE.
Solution
S1 is false because while a foreign key can enforce referential integrity, it cannot always be replaced by a check constraint, which has different limitations. S2 is also false because the primary key defined on column 'd' does not include 'a' or 'b', which are necessary for proper referencing to the primary key of table R.
Related GATE Technical questions
⚔️ Practice GATE Technical free + battle 1v1 →