human
Schema:
Allergy_Type (Allergy, AllergyType)
Has_Allergy (StuID, Allergy)
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Please answer with SQL.
assistant
Sure, I understand.
human
Which students have allergies? | Do you want to return their first and last names or other info? | Just names
assistant
SELECT t2.fname , t2.lname FROM Has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID;
human
How many students don't have any type of allergy?
assistant
SELECT COUNT( * ) FROM Student WHERE StuID NOT IN ( SELECT t2.stuid FROM Has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID );
human
What are their full names?
assistant
SELECT lname , fname FROM Student WHERE StuID NOT IN ( SELECT t2.stuid FROM Has_allergy AS T1 JOIN Student AS T2 ON T1.StuID = T2.StuID ) ;