Project ForgeSign up free
Database Management Systems
SQL & Transactions
GATE 2014
Hard

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?

  • AS1 is TRUE and S2 is FALSE.
  • BBoth S1 and S2 are TRUE.
  • CS1 is FALSE and S2 is TRUE.
  • Both S1 and S2 are FALSE.

Explanation

S1 is FALSE: in standard SQL, CHECK constraints cannot reliably enforce cross-table referential integrity the way a FOREIGN KEY declaration does (there is no guaranteed subquery-based equivalent that behaves identically under all inserts/updates/deletes to the referenced table). S2 is FALSE: R's primary key is the 2-column combination (a,b), so a FOREIGN KEY declaration on just the single column (a) cannot validly reference R — a foreign key must match the full arity of the referenced table's primary key (or another candidate key). So both S1 and S2 are FALSE.

Source: GATE CS 2014 (Session 1) (2014)

This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.

Start revising free