CREATE TABLE allergy_type (allergy TEXT, allergytype TEXT)
CREATE TABLE has_allergy (stuid DECIMAL, allergy TEXT)
CREATE TABLE student (stuid DECIMAL, lname TEXT, fname TEXT, age DECIMAL, sex TEXT, major DECIMAL, advisor DECIMAL, city_code TEXT)

How many students are affected by each allergy type?
SELECT T2.allergytype, COUNT(*) FROM has_allergy AS T1 JOIN allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype
SELECT "T2"."allergytype", COUNT(*) FROM "has_allergy" AS "T1" JOIN "allergy_type" AS "T2" ON "T1"."allergy" = "T2"."allergy" GROUP BY "T2"."allergytype"