Database: allergy_1

Question: How many allergy entries are there?
SQL: SELECT count(DISTINCT allergy) FROM Allergy_type

Question: How many distinct allergies are there?
SQL: SELECT count(DISTINCT allergytype) FROM Allergy_type

Question: What are the different allergy types?
SQL: SELECT DISTINCT allergytype FROM Allergy_type

Question: What are the allergies and their types?
SQL: SELECT allergy ,  allergytype FROM Allergy_type

Question: What are all the different food allergies?
SQL: SELECT DISTINCT allergy FROM Allergy_type WHERE allergytype  =  "food"

Question: What is allergy type of a cat allergy?
SQL: SELECT allergytype FROM Allergy_type WHERE allergy  =  "Cat"

Question: How many animal type allergies exist?
SQL: SELECT count(*) FROM Allergy_type WHERE allergytype  =  "animal"

Question: What are the allergy types and how many allergies correspond to each one?
SQL: SELECT allergytype ,  count(*) FROM Allergy_type GROUP BY allergytype

Question: Which allergy type is most common?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) DESC LIMIT 1

Question: Which allergy type is the least common?
SQL: SELECT allergytype FROM Allergy_type GROUP BY allergytype ORDER BY count(*) ASC LIMIT 1

Question: What is the total number of students?
SQL: SELECT count(*) FROM Student

Question: What are the full names of all students
SQL: SELECT Fname ,  Lname FROM Student

Question: How many advisors are there?
SQL: SELECT count(DISTINCT advisor) FROM Student

Question: What are the different majors?
SQL: SELECT DISTINCT Major FROM Student

Question: What cities do students live in?
SQL: SELECT DISTINCT city_code FROM Student

Question: What are the full names and ages for all female students whose sex is F?
SQL: SELECT Fname ,  Lname ,  Age FROM Student WHERE Sex  =  'F'

Question: What are the student ids for all male students?
SQL: SELECT StuID FROM Student WHERE Sex  =  'M'

Question: How many students are 18 years old?
SQL: SELECT count(*) FROM Student WHERE age  =  18

Question: What are the student ids for students over 20 years old?
SQL: SELECT StuID FROM Student WHERE age  >  20

Question: Give the city that the student whose family name is Kim lives in.
SQL: SELECT city_code FROM Student WHERE LName  =  "Kim"

Question: Who advises student 1004?
SQL: SELECT Advisor FROM Student WHERE StuID  =  1004

Question: Give the number of students living in either HKG or CHI.
SQL: SELECT count(*) FROM Student WHERE city_code  =  "HKG" OR city_code  =  "CHI"

Question: What is the minimum, mean, and maximum age across all students?
SQL: SELECT min(age) ,  avg(age) ,  max(age) FROM Student

Question: Provide the last name of the youngest student.
SQL: SELECT LName FROM Student WHERE age  =  (SELECT min(age) FROM Student)

Question: What student id corresponds to the oldest student?
SQL: SELECT StuID FROM Student WHERE age  =  (SELECT max(age) FROM Student)

Question: How many students are there for each major?
SQL: SELECT major ,  count(*) FROM Student GROUP BY major

Question: What is the largest major?
SQL: SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1