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
What are the first and last name of all the students?
assistant
SELECT fname , lname FROM Student;
human
Of them, who are allergic to any type of food?
assistant
SELECT DISTINCT T3.fname , T3.lname FROM Has_allergy AS T1 JOIN Allergy_Type AS T2 ON T1.Allergy = T2.Allergy JOIN Student AS T3 ON T1.StuID = T3.StuID WHERE T2.allergytype = "food" ;