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 distinct majors.
assistant
SELECT DISTINCT major FROM student;
human
Which has the most number of students?
assistant
SELECT Major FROM Student GROUP BY Major ORDER BY COUNT( Major ) DESC LIMIT 1 ;
human
Which has the least?
assistant
SELECT Major FROM Student GROUP BY Major ORDER BY COUNT( Major ) ASC LIMIT 1 ;
human
Give the count to prove it.
assistant
SELECT Major , COUNT( * ) FROM Student GROUP BY Major ORDER BY COUNT( Major ) ASC LIMIT 1 ;