Show all allergy type with number of students affected.
CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR)
SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
<s>[INST] Write mssql query to answer the following question given the database schema. Schema: CREATE TABLE Has_allergy (allergy VARCHAR); CREATE TABLE Allergy_type (allergytype VARCHAR, allergy VARCHAR) Question: Show all allergy type with number of students affected. [/INST] SELECT T2.allergytype, COUNT(*) FROM Has_allergy AS T1 JOIN Allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype </s>