Dark Mode

15,096 views

35 votes

The following table has two attributes $A$ and $C$ where $A$ is the primary key and $C$ is the foreign key referencing $A$ with on-delete cascade.

$$\begin{array}{|c|c|} \hline \textbf {A} & \textbf {C} \\\hline \text {2} & \text{4} \\\hline \text{3} & \text{4} \\\hline \text{4} & \text{3} \\\hline \text{5} & \text{2} \\\hline \text {7} & \text{2} \\\hline \text{9} & \text{5} \\\hline \text{6} & \text{4} \\\hline \end{array}$$

The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple $(2, 4)$ is deleted is:

- $(3, 4)$ and $(6, 4)$
- $(5, 2)$ and $(7, 2)$
- $(5, 2), (7, 2)$ and $(9, 5)$
- $(3, 4), (4, 3)$ and $(6, 4)$

46 votes

Best answer

13 votes

here A is behaving like parent and C is behaving like child bcoz A is PK and C is FK referencing to A.

when (2,4) is deleted then it force to delete all entries in which C contains 2 bcoz there is no 2 remains in parent so child not able to access 2. so delete (5,2) (7,2) which force to delete all entries in which C contains 5or7 bcoz there is no 5 or 7 remain in parent so child not able to access 5 or 7.so delete (9,5) which force to delete all entries in which C contains 9 .

so ans should be **C**