📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

When is ON DELETE SET NULL NOT a suitable choice for a foreign key?

A. When the foreign key column allows NULL values and the child can exist without a parent
B. When the parent is rarely deleted
C. When the child row must always have a parent and the foreign key is NOT NULL ✅
D. When child rows are historical records that should be kept

Correct Answer: C. When the child row must always have a parent and the foreign key is NOT NULL

Explanation

SET NULL requires a nullable foreign key; if the column is NOT NULL the action cannot be applied and the delete fails.