GATE CSE 2017 Session 2 Q29: Records deleted from T1 with cascade and set NULL foreign keys
- Databases
- 1 mark
- NAT
- No negative marking
Syllabus topic: Integrity constraints and normal forms
Question
Consider the following tables T1 and T2.
| P | Q |
|---|---|
| 2 | 2 |
| 3 | 8 |
| 7 | 3 |
| 5 | 8 |
| 6 | 9 |
| 8 | 5 |
| 9 | 8 |
| R | S |
|---|---|
| 2 | 2 |
| 8 | 3 |
| 3 | 2 |
| 9 | 7 |
| 5 | 7 |
| 7 | 2 |
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 from table T1, the number of additional records that need to be deleted from table T1 is ________.
Try it: numerical answer: type the value
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.
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
Source: official GATE 2017 Session 2 CS question paper and final answer key, organised by IIT Roorkee. Question paper · Answer key
More Databases PYQs
- 2026 Session 1 · Q30Which functional dependency inferences always hold
- 2026 Session 1 · Q31Dependency-preserving decompositions for 1NF, 2NF, 3NF, BCNF
- 2026 Session 1 · Q43Relational algebra equivalent of a tuple calculus join query
- 2026 Session 1 · Q65Number of superkeys with candidate keys {A,B} and {A,C}
- 2026 Session 2 · Q15Match DBMS schema levels with what they describe
- 2026 Session 2 · Q20When two transactions do not conflict on a data item