📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

If ON DELETE RESTRICT is set and a user tries to delete a referenced Author, what should the application do first?

A. Change the AuthorID to NULL
B. Set the AuthorID to zero
C. Delete or reassign the author's Books, then delete the Author ✅
D. Delete the Author directly and ignore the error

Correct Answer: C. Delete or reassign the author's Books, then delete the Author

Explanation

RESTRICT blocks the delete while children exist, so the dependent rows must be handled first.