Introduction
Foreign key ON DELETE behavior controls what happens to related data when a record is deleted. It helps keep data correct and avoids broken links.
When you want to delete a customer and also remove all their orders automatically.
When you want to prevent deleting a product if there are still orders using it.
When you want to set a related field to empty if the linked record is deleted.
When you want to keep related data unchanged even if the linked record is deleted.