Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i wana to develop a database table that relates disease with their symptom. in this case my first aim is i have many disease each having their own symptom and one disease can share the symptoms of another symptom how can i create their relationship.

example:
disease A: has symptoms: a ,b ,c ,d
disease B: has symptoms: e ,a ,d ,f,g
disease C: has symptoms: k ,l, g ,b ...
and soon how can i relate them in adatabase
thank U for U'r Help.
Posted

Add a table called Disease and another called Symptoms (both have primary keys).

Put all disease names (A,B,C) in the Disease table.

e.g.
Disease Id - 1,2,3
Disease Name - A,B,C

Put all symptoms (a,b,c) in the Symptoms table.

e.g.
Symptom Id- 1,2,3
Symptom name - a,b,c

Create a third table called DiseaseSymptoms - put the diseasename id against the symptom id here.

Disease Id - 1,
Symptom Id - 2,1,3,4
Disease Id - 2
Symptom Id - 5,2,1

and so on....
 
Share this answer
 
1 disease has many symptoms, but 1 symptom can appear in many diseases, it's a many to many relationship, your real issue is what weight to apply to each symptom for a disease.
As Abhinav S pointed out you only need 3 tables to model what you are describing but what happens when you have two or more disease that present similar symptoms, but then that is what doctors are supposed to be trained in.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900