Databases · Junior · Question 68 of 75
What does ON DELETE CASCADE on a foreign key do?
- 1Prevents deleting the referenced row
- 2Deletes the whole table
- ✓Correct answer: Deleting the referenced row also deletes the rows that reference it
Explanation
For example, deleting a user deletes their sessions. The default (NO ACTION) blocks the delete while references exist; SET NULL clears the reference.