依据以上的表,可以实现: 1。从动物名可以查到每个症状的图片和文字说明 select s.symptom_name, p.pic_text, p.picture from animal a, animal_symptom a_s,symptom s, picture p where a.name='xxx' and a.animal_id=a_s.animal_id and a_s.symptom_id=s.sympton_id and a_s.pic_id = p.pic_id. 2。从一个某动物症状查到该种动物含有该症状可能产生的疾病,并能够在查到某种疾病的其他症状。 略 另外,如果每个症状都有不同图片的话,你可以将picture table 合并到animal_symptom中。
(
animal_id, #primary key
name,
...
);
create table symptom
(
symptom_id, #primary key
....
)
create table animal_symptom
(
animal_symptom_id, #primary key
animal_id, #foreign key not null
symptom_id, #foreign key not null
pic_id #foreign key
)
create table picture
(
pic_id, # primary key
pic_text,
picture
)
1。从动物名可以查到每个症状的图片和文字说明
select s.symptom_name, p.pic_text, p.picture
from animal a, animal_symptom a_s,symptom s, picture p
where a.name='xxx' and a.animal_id=a_s.animal_id and a_s.symptom_id=s.sympton_id and a_s.pic_id = p.pic_id.
2。从一个某动物症状查到该种动物含有该症状可能产生的疾病,并能够在查到某种疾病的其他症状。
略
另外,如果每个症状都有不同图片的话,你可以将picture table 合并到animal_symptom中。