Question: Find the number of male (sex is 'M') students who have some food type allery.
Schema: create table has_allergy (allergy varchar, PRIMARY KEY (allergy)); create table allergy_type (allergy varchar, allergytype varchar, PRIMARY KEY (allergy)); create table student (sex varchar, stuid varchar, PRIMARY KEY (sex))
SQL: select count(*) from student where sex = "m" and stuid in (select stuid from has_allergy as t1 join allergy_type as t2 on t1.allergy = t2.allergy where t2.allergytype = "food")