SELECT a.admission_id, a.patient_id, a.attending_doctor_id FROM admissions a LEFT JOIN patients p ON a.patient_id = p.patient_id LEFT JOIN doctors d ON a.attending_doctor_id = d.doctor_id WHERE p.patient_id IS NULL OR d.doctor_id IS NULL;
Write your query and click "Run Query" (Ctrl + Enter) to see results and testcase validation.