Last Updated : 25 Jan, 2019

Consider the following tables T1 and T2:



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 cascade 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 ________.
(A) 5
(B) 4
(C) 2
(D) 3


Answer: (C)

Explanation: If record (3, 8) from table T1 is deleted, then you need to delete record (8, 3) from table T2 in order to foreign key 3 in table T2 which refers primary key 8 in table T1.

Now, if you delete record (8, 3) from table T2, then you need to delete (5, 8) and (9, 8) from table T1 to preserve forign key 8 in table T1 which refers primary key in table T2.

Therefore, numbers of additional record that need to be deleted from table T1 is 2.

option (C) is correct.

Quiz of this Question


Share your thoughts in the comments