2

If i have the following scenario.

Every doctor can diagnose a disease for different patients. A diagnose holds a date and disease(multi valued attribute). So the patient has testing that need to be done with investigation, the investigation holds type, description and title and testing holds date. For each investigation we know the disease that need to be investigated, hence one disease can have multiple investigations.

This is the sentence where i have difficulties

For each investigation we know the disease that need to be investigated, hence one disease can have multiple investigations.

I have the following diagram so far. My question is can i connect multivalued disease with Investigation entity? I am new to EER diagrams

enter image description here

0

Yes, you can.

You could create a table for Diseases:

TABLE disease
-------------
disease.id (PK)
disease.name 

Then you can model Diagnosis (note that's a junction table) this way:

TABLE diagnosis
---------------
diagnosis.id (PK)
diagnosis.date
diagnosis.doctor_id (FK)
diagnosis.patient_id (FK)
diagnosis.disease_id (FK)

So you can add a Disease to an Investigation:

TABLE investigation
-------------------
investigation.id (PK)
investigation.type
investigation.title
investigation.description
investigation.disease_id (FK) 

And finally, here's the table for Testing:

TABLE testing
-------------
testing.id (PK)
testing.date
testing.investigation_id (FK)
testing.patient_id (FK)

The Testing can as well be included as a field in Investigation instead of having its own table, unless the exercise requires it.

Then there are the tables for Doctor and Patient which you already modeled.

This is the description of the tables, from it you can easily create the ER diagram, remembering that a FK on a table connects to the PK on another table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.