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

How many male students (sex is 'M') are allergic to any type of food?
SELECT COUNT(*) FROM student WHERE sex = "M" AND stuid IN (SELECT stuid FROM has_allergy AS T1 JOIN allergy_type AS T2 ON T1.allergy = T2.allergy WHERE T2.allergytype = "food")
SELECT COUNT(*) FROM "student" WHERE "M" = "sex" AND "stuid" IN (SELECT "stuid" FROM "has_allergy" AS "T1" JOIN "allergy_type" AS "T2" ON "T1"."allergy" = "T2"."allergy" AND "T2"."allergytype" = "food")