Skip to main content

GATE CSE 2014Databases › SQLVerified

GATE CSE 2014 PYQ: Given the following statements: S1 : A foreign key declaration can always be replaced by an equivalent check…

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)R(a,b,c) where aa and bb 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?

  1. A
    S1 is TRUE and S2 is FALSE
  2. B
    Both S1 and S2 are TRUE
  3. C
    S1 is FALSE and S2 is TRUE
  4. D
    Both S1 and S2 are FALSE
    Correct answer

Answer

(D) Both S1 and S2 are FALSE

Approach

Evaluate each statement independently against SQL integrity-constraint semantics. S1 asks whether a single CHECK assertion can fully emulate a FOREIGN KEY; S2 asks whether a FOREIGN KEY may reference a set of columns that is not a candidate key of the parent table. Determine the truth of each, then match the correct option.

A FOREIGN KEY enforces referential integrity across tables and responds to parent-side changes, which a row-level CHECK constraint cannot do, making S1 false. A FOREIGN KEY must reference a candidate key of the parent relation; since only (a, b) is a key of R, referencing a alone is invalid, making S2 false. Therefore both statements are false - option D.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.