I need help with this design, a Diagnosis can be based on evidence or test result or both. I have separate evidence table (eg: cough, medicine can be prescribed with out any other test) and Test table (eg: blood test). I want the diagnosis table to address all scenarios (based on evidence only, based test result only, based on both evidence and test result. My table structure is Diagnosis_id, patient_id, evid_id, test_id,Dignosis_name. I want to refer evid_id and test_id as foreign key but having this would mean I must always provide both values, which wouldn’t be the case. Any advice?
Share
A foreign key can be null.
You’d probably need a query like
Using left joins means that you’ll always get a result set, regardless of whether the diagnosis is linked to the evidence table or the tests table (or neither).