Skip to content
Official PYQ · 2005

GATE CS 2005 Q76 — Integrity Constraints

Explain with AI

The following table has two attributes AA and CC where AA is the primary key and CC is the foreign key referencing AA with on-delete cascade.
AC24344352729564\begin{array}{|c|c|} \hline \textbf{A} & \textbf{C} \\ \hline \text{2} & \text{4} \\ \hline \text{3} & \text{4} \\ \hline \text{4} & \text{3} \\ \hline \text{5} & \text{2} \\ \hline \text{7} & \text{2} \\ \hline \text{9} & \text{5} \\ \hline \text{6} & \text{4} \\ \hline \end{array}

The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple (2,4)(2, 4) is deleted is:

Choose one option
View worked solution

Answer: C

The referential integrity constraint states that the foreign key CC references the primary key AA with an on-delete cascade policy. This means that if a tuple with primary key value A=xA = x is deleted, all tuples with foreign key value C=xC = x must also be automatically deleted.

Let's trace the cascade deletion step-by-step starting with the deletion of the tuple (2,4)(2, 4):

  1. Delete (2,4)(2, 4):
    This removes the primary key value A=2A = 2 from the relation.
  2. Cascade to C=2C = 2:
    We must delete all tuples where the foreign key C=2C = 2. Looking at the table, these tuples are:
    • (5,2)(5, 2)
    • (7,2)(7, 2)
  3. Cascade from the newly deleted tuples:
    • Deleting (5,2)(5, 2) removes the primary key value A=5A = 5. Thus, we must delete all tuples where C=5C = 5. The only such tuple is (9,5)(9, 5).
    • Deleting (7,2)(7, 2) removes the primary key value A=7A = 7. Thus, we must delete all tuples where C=7C = 7. There are no such tuples in the table.
  4. Cascade from (9,5)(9, 5):
    Deleting (9,5)(9, 5) removes the primary key value A=9A = 9. Thus, we must delete all tuples where C=9C = 9. There are no such tuples in the table.

Therefore, the set of all tuples that must be additionally deleted to maintain referential integrity is (5,2)(5, 2), (7,2)(7, 2), and (9,5)(9, 5).

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

Published
Report a correction
Keep exploringMore Integrity Constraints questions