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
How many allergies are there?
assistant
SELECT count(DISTINCT allergy) FROM Allergy_type
human
How many students are there?
assistant
SELECT count(*) FROM Student
human
Who is the advisor of student with ID 1004?
assistant
SELECT Advisor FROM Student WHERE StuID = 1004
human
Show all advisors and corresponding number of students.
assistant
SELECT advisor , count(*) FROM Student GROUP BY advisor
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 different advisors are listed?
assistant
SELECT COUNT( DISTINCT advisor ) FROM Student ;