How many different types of allergies are there?
select count ( distinct allergy ) from has_allergy
What allergy is most prevalent among students?
select allergy from student as t1 join has_allergy as t2 on t1.stuid = t2.stuid group by allergy order by count ( * ) desc limit 1
How many male students have a tree pollen allergy?
select count ( * ) from student as t1 join has_allergy as t2 on t1.stuid = t2.stuid where allergy = "Tree Pollen" and t1.sex = "M"
How many students have a soy allergy?
select count ( * ) from student where stuid in ( select stuid from has_allergy where allergy = "Soy" )
How many students don't have a soy allergy?
select count ( * ) from student where stuid not in ( select stuid from has_allergy where allergy = "Soy" )
Yes please. First name and major.
select fname, major from student where stuid not in ( select stuid from has_allergy where allergy = "Soy" )