📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

A Hospital uses Treatment as a junction table between Doctor and Patient. If a Doctor leaves, what should happen to Treatment rows?

A. It depends on the referential action: CASCADE deletes them, SET NULL keeps them without a doctor, RESTRICT blocks the delete ✅
B. It always deletes the hospital
C. It always keeps the doctor row
D. It always deletes the patients

Correct Answer: A. It depends on the referential action: CASCADE deletes them, SET NULL keeps them without a doctor, RESTRICT blocks the delete

Explanation

The outcome is decided by the ON DELETE action defined on the DoctorID foreign key in Treatment.