Skip to content
GATEiit

GATE CSE 2017 Session 2 Q29: Records deleted from T1 with cascade and set NULL foreign keys

Syllabus topic: Integrity constraints and normal forms

Question

Consider the following tables T1 and T2.

T1
PQ
22
38
73
58
69
85
98
T2
RS
22
83
32
97
57
72

In table T1, P is the primary key and Q is the foreign key referencing R in table T2 with on-delete cascade and on-update cascade. In table T2, R is the primary key and S is the foreign key referencing P in table T1 with on-delete set NULL and on-update cascade. In order to delete record ⟨3,8⟩ from table T1, the number of additional records that need to be deleted from table T1 is ________.

Try it: numerical answer: type the value

Numerical answer. No negative marking.
Show answer and explanation

Answer: 0 (official GATE 2017 final answer key)

Concept used: Referential actions propagate only as declared: deleting a referenced row with ON DELETE SET NULL nulls the referencing values instead of deleting rows.

Concept notes

Loading notes…

First step: Find the T2 rows whose S refers to P = 3 and apply T2's on-delete action to them, then see whether any T2 row is actually deleted.

Full step-by-step solution

Loading…

Answer from the official final answer key. Found a mistake? Use Report issue and we will fix it.

More questions on Integrity constraints and normal forms

Every PYQ on this topic →

Share this question

WhatsAppDownload image

Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key