The GATE Grind

GATE 2017 CS (CS2) – Question 29

Databases · Integrity Constraints and Normal Forms · 1 mark · Numerical answer

Tables T₁(P,Q) = {(2,2),(3,8),(7,3),(5,8),(6,9),(8,5),(9,8)} and T₂(R,S) = {(2,2),(8,3),(3,2),(9,7),(5,7),(7,2)}. P and R are primary keys. T₁.Q references T₂.R with ON DELETE CASCADE and ON UPDATE CASCADE. T₂.S references T₁.P with ON DELETE SET NULL and ON UPDATE CASCADE. Deleting (3,8) from T₁ causes how many additional T₁ deletions?

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 0.0 to 0.0

Explanation

Deleting the T₁ row whose P=3 affects the T₂ row (8,3): its S reference is set to NULL, not deleted. T₂.R=8 remains unchanged, so T₁ rows that reference it remain valid and no cascade deletion is triggered. Additional T₁ deletions therefore equal 0.

More Integrity Constraints and Normal Forms questions

All Integrity Constraints and Normal Forms questions →