instruction: how many patients whose admission type is emergency and lab test category is chemistry?
response: SELECT COUNT(DISTINCT demographic.subject_id) FROM demographic INNER JOIN lab ON demographic.hadm_id = lab.hadm_id WHERE demographic.admission_type = "EMERGENCY" AND lab."CATEGORY" = "Chemistry"