human
Schema:
Allergy_Type (Allergy, AllergyType)
Has_Allergy (StuID, Allergy)
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Please answer with SQL.
assistant
Sure, I understand.
human
How many students are there?
assistant
SELECT COUNT( distinct StuID ) FROM Has_allergy;
human
How many allergies are there?
assistant
SELECT COUNT( distinct allergy ) FROM Has_allergy;
human
Can you display all student IDs with at least two allergies?
assistant
SELECT StuID FROM Has_allergy GROUP BY StuID HAVING COUNT( * ) > = 2 ;