Skip to content
Official PYQ · 2017

GATE CS 2017 Set 2 Q19 — Integrity Constraints

Explain with AI

Consider the following tables T1T1 and T2.T2.

PQ22 3873586 98598T1RS22 8332975 772T2\overset{T1}{\begin{array}{|c|c|c|} \hline \textbf{P} & \textbf{Q} \\ \hline \text{2} & \text{2 }\\ \hline \text{3} & \text{8} \\ \hline \text{7} & \text{3} \\ \hline \text{5} & \text{8} \\ \hline \text{6 } &\text{9} \\ \hline \text{8} & \text{5} \\ \hline \text{9} & \text{8} \\ \hline \end{array}} \qquad \overset{T2}{\begin{array}{|c|c|c|} \hline \textbf{R} & \textbf{S} \\ \hline \text{2} & \text{2 }\\ \hline \text{8} & \text{3} \\ \hline \text{3} & \text{2} \\ \hline \text{9} & \text{7} \\ \hline \text{5 } &\text{7} \\ \hline \text{7} & \text{2} \\ \hline \end{array}}

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

View worked solution

Answer: 0.00

To find the number of additional records deleted from table T1T1 when we delete the record ⟨3,8⟩\langle 3, 8 \rangle, let us trace the referential integrity constraints step-by-step.

1. Initial Deletion

We delete the record ⟨3,8⟩\langle 3, 8 \rangle from table T1T1.

  • This removes the primary key value P=3P = 3 from T1T1.

2. Check References to PP in T1T1

The attribute SS in table T2T2 is a foreign key referencing PP in T1T1 with the rule ON DELETE SET NULL.

  • We look for records in T2T2 where S=3S = 3.
  • The record ⟨8,3⟩\langle 8, 3 \rangle in T2T2 has S=3S = 3.
  • Applying the ON DELETE SET NULL action, this record is updated to ⟨8,NULL⟩\langle 8, \text{NULL} \rangle.
  • Note: This is an update operation on T2T2, not a deletion. No records are deleted from T2T2.

3. Check References to RR in T2T2

The attribute QQ in table T1T1 is a foreign key referencing RR in T2T2 with the rule ON DELETE CASCADE.

  • Since no records were deleted from T2T2, this cascade action is not triggered.
  • No further records in T1T1 are affected.

Conclusion

No additional records need to be deleted from table T1T1.

Therefore, the number of additional records that need to be deleted from T1T1 is 0.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Integrity Constraints questions