GATE / CS ARCHIVE

GATE CSE 2014 SET 1 / QUESTION 22

GATE CSE 2014 Set 1 Q22

Database Management Systems · SQL & Queries · Full GATE CSE 2014 Set 1 paper

GATE 2014 Set 1, Q22 1 mark · MCQ
Report issue

SQL & Queries

Question 22, GATE 2014: S1: A foreign-key declaration can always be replaced by an equivalent SQL check assertion. S2: If R(a,b,c) has composite primary key (a,b), then CREATE TABLE S(a INTEGER,d INTEGER,e INTEGER,PRIMARY KEY(d),FOREIGN KEY(a) REFERENCES R) is valid. Choose A: S1 true, S2 false. B: both true. C: S1 false, S2 true. D: both false.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

Our answer: D with full referential-action semantics; A for constraints alone

1. Method and setup. Check S2 structurally: omitting referenced column names means referencing R’s primary key, which has two columns, unlike the one-column foreign key. For S1, distinguish an assertion describing permitted database states from actions performed during an update or deletion. “Always equivalent” is ambiguous unless that distinction is specified.

2. Work through the result and its assumptions. S2 is false: the implicit referenced key is composite(a, b), but the foreign key has only one column. For S1, an SQL ASSERTION can express the allowed-state condition for an ordinary foreign key, including NULL exemptions, so under constraint-only equivalence S1 is true and A follows. An assertion alone cannot implement ON DELETE/UPDATE CASCADE or SET NULL actions; interpreting always as full behavioral equivalence makes S1 false and supports official D. This distinction is unstated; retain the official key and disclose both readings.

Original paper, page 12 · Answer key