Databases · Middle · Question 75 of 75
What does a foreign key with ON DELETE RESTRICT (or the default NO ACTION) do when you delete a referenced row?
- 1The referencing rows are deleted too
- 2The reference is set to NULL
- ✓Correct answer: The delete fails while other rows still reference it
Explanation
It protects against orphaned rows. NO ACTION can be deferred to the end of the transaction with DEFERRABLE, RESTRICT cannot.