GATE | GATE-CS-2017 (Set 2) | Question 21

Consider the following tables T1 and T2:

g2017_14

In table T1, P is the primary key, 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 the table T1 with on-delete set NULL and on-update cascade. In order to delete record (3,8) from table, numbers of additional record that need to be deleted from table T1 is ______.



Note: This question appeared as Numerical Answer Type.
(A) 0
(B) 1
(C) 2
(D) 3


Answer: (A)

Explanation: Given,

  • Q -> R(Primary Key)
  • S -> P (Primary Key)

Entry to be deleted – P (3) and Q(8)

  • Q can be deleted directly
  • Now, S – > P but the relationship given is on delete set NULL, Therefore when  we delete 3 from  T1 ,the  entry in T2 having 3 will be NULL.

Therfore, Option A  – Answer is 0 entries

Quiz of this Question



My Personal Notes arrow_drop_up