human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Restaurant (ResID, ResName, Address, Rating)
Type_Of_Restaurant (ResID, ResTypeID)
Restaurant_Type (ResTypeID, ResTypeName, ResTypeDescription)
Visits_Restaurant (StuID, ResID, Time, Spent)
Please answer with SQL.
assistant
Sure, I understand.
human
Give the distinct advisors of students.
assistant
SELECT DISTINCT advisor FROM student;
human
Which of those advises the most students?
assistant
SELECT Advisor FROM Student GROUP BY Advisor ORDER BY COUNT( Advisor ) DESC LIMIT 1 ;
human
Give the count, too.
assistant
SELECT Advisor , COUNT( * ) FROM Student GROUP BY Advisor ORDER BY COUNT( Advisor ) DESC LIMIT 1 ;