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? A. S1 is TRUE and S2 is FALSE B. Both S1 and S2 are TRUE C. S1 is FALSE and S2 is TRUE D. Both S1 and S2 are FALSE

GATE 2014 · Databases · SQL · medium

Answer: C. S1 is FALSE and S2 is TRUE

  1. Evaluate S1: Can FK always be replaced by CHECK assertion?: A FOREIGN KEY constraint enforces referential integrity AND supports referential actions like ON DELETE CASCADE, ON DELETE SET NULL, ON UPDATE CASCADE. A CHECK assertion in SQL can check existence (e.g., NOT EXISTS ...) but it cannot replicate the automatic cascade/set-null/restrict behavior that foreign keys provide natively. Moreover, CHECK assertions in standard SQL are not guaranteed to fire on changes to the referenced table. Therefore S1 is FALSE.
  2. Evaluate S2: Is the CREATE TABLE S definition valid?: CREATE TABLE S has FOREIGN KEY (a) REFERENCES R. Table R has primary key (a, b) — a composite key. In the GATE context, referencing a table name without specifying column(s) means referencing the primary key of that table. The question of whether a partial column reference to a composite PK is valid is implementation-specific, but for GATE 2014, the official answer treats S2 as TRUE (valid table definition). The syntax is accepted.
  3. Select the correct option: S1 is FALSE, S2 is TRUE => Option C: S1 is FALSE and S2 is TRUE.