Task: Text to Code
Input (English): How many students are affected by each allergy type?
Output (English): SELECT T2.allergytype ,  count(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy  =  T2.allergy GROUP BY T2.allergytype