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 advisor has most number of students?
assistant
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
human
Show all majors and corresponding number of students.
assistant
SELECT major , count(*) FROM Student GROUP BY major
human
Show all ages and corresponding number of students.
assistant
SELECT age , count(*) FROM Student GROUP BY age
human
How many students are age 18?
assistant
SELECT count(*) FROM Student WHERE age = 18
human
Which major has most number of students?
assistant
SELECT major FROM Student GROUP BY major ORDER BY count(*) DESC LIMIT 1
human
What is the total number of students?
assistant
SELECT COUNT( * ) FROM Student ;