human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Voting_record (StuID, Registration_Date, Election_Cycle, President_Vote, Vice_President_Vote, Secretary_Vote, Treasurer_Vote, Class_President_Vote, Class_Senator_Vote)
Please answer with SQL.
assistant
Sure, I understand.
human
What are all of the advisors?
assistant
SELECT DISTINCT Advisor FROM STUDENT;
human
How many advise 2 students or less?
assistant
SELECT COUNT( * ) FROM ( SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT( * ) <= 2 );
human
How many advise more than 2 students?
assistant
SELECT COUNT( * ) FROM ( SELECT Advisor FROM STUDENT GROUP BY Advisor HAVING COUNT( * ) > 2 ) ;