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
What are all the different allergies?
assistant
SELECT DISTINCT Allergy FROM Has_allergy;
human
How many students does each of them affect?
assistant
SELECT Allergy , COUNT( * ) FROM Has_allergy GROUP BY Allergy ;