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
Who is the advisor of student with ID 1004?
assistant
SELECT Advisor FROM Student WHERE StuID = 1004
human
How many students are age 18?
assistant
SELECT count(*) FROM Student WHERE age = 18
human
How many students are there?
assistant
SELECT count(*) FROM Student
human
How many different advisors are listed?
assistant
SELECT count(DISTINCT advisor) FROM Student
human
Which advisor has most number of students?
assistant
SELECT advisor FROM Student GROUP BY advisor ORDER BY count(*) DESC LIMIT 1
human
How many students does each advisor have?
assistant
SELECT advisor , COUNT( * ) FROM Student GROUP BY advisor ;