Side Effects Directly in SQL
select E.Symptom, T.Medicine
from diagnoses D, exhibits E, treatments T
where D.Patient = E.Patient
and D.Patient = T.Patient
and E.Symptom not in
(select C.Symptom
from causes C
where C.Disease = D.Disease)
having count (distinct P) >= 20
group by E.Symptom, T.Medicine