Cascade Delete

Cascade Delete

What is the syntax for doing a cascade delete in SQL? For instance, I have a table with a parent record that has child records in other tables, filtering down many levels. How do I delete out of the parent table and all of the children tables in one command?

Cascade deletes aren’t delivered ‘out of the box’ like the other Declarative Referential Integrity actions.

In order to accomplish what you are after, you need to do your own child record deletes by starting at the bottom and working your way ‘up’ (back to the parent record contributing the foreign key in the child table). Once you delete the child records, you will be able to delete the parents.


Share the Post: