📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

What is the main difference between ON DELETE CASCADE and ON DELETE SET NULL?

A. Both delete child rows, but CASCADE is faster
B. CASCADE keeps child rows, whereas SET NULL deletes them
C. Both keep child rows, but SET NULL is faster
D. CASCADE deletes child rows, whereas SET NULL keeps them with a NULL foreign key ✅

Correct Answer: D. CASCADE deletes child rows, whereas SET NULL keeps them with a NULL foreign key

Explanation

CASCADE removes dependents, while SET NULL preserves them without a parent link.