Skip to content
Official PYQ · 1997

GATE CS 1997 Q6.10 — Integrity Constraints

Explain with AI

Let R(a,b,c)R (a, b, c) and S(d,e,f)S(d, e, f) be two relations in which dd is the foreign key of SS that refers to the primary key of RR. Consider the following four operations RR and SS

  1. Insert into RR

  2. Insert into SS

  3. Delete from RR

  4. Delete from SS

Which of the following can cause violation of the referential integrity constraint above?

Choose one option
View worked solution

Answer: B

A referential integrity constraint requires that any value of a foreign key in a referencing relation must exist as a primary key value in the referenced relation.

Here, SS is the referencing relation (with foreign key dd) and RR is the referenced relation (with primary key, say, aa). Thus, for every tuple in SS, the value of dd must exist in the primary key column of RR.

Let's analyze the four operations:

  1. I. Insert into RR: Safe. Adding a new primary key value to RR does not affect any existing references in SS.
  2. II. Insert into SS: Can cause a violation. If we insert a tuple into SS with a foreign key value dd that does not exist in RR, the referential integrity is violated.
  3. III. Delete from RR: Can cause a violation. If we delete a tuple from RR whose primary key is currently referenced by one or more tuples in SS, those tuples in SS will be left with dangling references.
  4. IV. Delete from SS: Safe. Removing a tuple from the referencing relation SS never creates any dangling references.

Therefore, only operations II and III can cause a violation of the referential integrity constraint.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Integrity Constraints questions