Concept Flow - Foreign key ON DELETE behavior
Delete row in parent table
Check foreign key constraints
ON DELETE CASCADE
Delete matching child rows
ON DELETE RESTRICT
Prevent delete if child rows exist
End
When deleting a row in the parent table, the database checks the foreign key's ON DELETE rule and either deletes child rows, sets their foreign keys to NULL, or prevents the delete.