Below is the list of tables from the database along with their columns and datatype. Need to generate an accurate SQL query for the question.
Only use the columns present in the respective table. Only use the columns which are required to generate the SQL query. Only use table joins if required and not otherwise.

### Tables ###
TABLE: CREATE TABLE student ( stuid number, lname text, fname text, age number, sex text, major number, advisor number, city_code text )
TABLE: CREATE TABLE allergy_type ( allergy text, allergytype text )
TABLE: CREATE TABLE has_allergy ( stuid number, allergy text )

### Question ###
Show all allergy type with number of students affected.

### Accurate SQL ###

SELECT T2.allergytype, COUNT(*) FROM has_allergy AS T1 JOIN allergy_type AS T2 ON T1.allergy = T2.allergy GROUP BY T2.allergytype