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
Report all majors.
assistant
SELECT DISTINCT Major FROM STUDENT;
human
Report the number of students per major as well.
assistant
SELECT Major , COUNT( * ) FROM STUDENT GROUP BY Major;
human
Order the majors by decreasing number of students.
assistant
SELECT Major , COUNT( * ) FROM STUDENT GROUP BY Major ORDER BY COUNT( * ) DESC;
human
Which major has the most students?
assistant
SELECT Major FROM STUDENT GROUP BY major ORDER BY COUNT( * ) DESC LIMIT 1 ;