CS FundamentalsEasyWipro · Cognizant pattern

A foreign key column is declared `ON DELETE CASCADE`. If the referenced (parent) row is deleted, what happens to the child rows referencing it?

  1. A. The database automatically deletes all the matching child rows as part of the same operation
  2. B. The foreign key column in the child rows is automatically set to NULL
  3. C. Nothing happens to the child rows; the foreign key constraint is simply ignored on delete
  4. D. The delete on the parent row fails until all child rows are manually removed

Correct answer: A. The database automatically deletes all the matching child rows as part of the same operation

ON DELETE CASCADE propagates the delete: removing a parent row automatically removes every child row whose foreign key pointed to it, keeping referential integrity without the application needing to delete children explicitly. ON DELETE SET NULL would instead null out the FK column, and the default (NO ACTION/RESTRICT) is what blocks the parent delete until children are handled.

More DBMS and SQL questions

Exams that ask this topic