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
Which major has the highest number of students?
assistant
SELECT major FROM Student GROUP BY major ORDER BY COUNT( * ) DESC LIMIT 1;
human
What is the average age of the students in this major?
assistant
SELECT AVG ( age ) FROM student WHERE major = ( SELECT major FROM Student GROUP BY major ORDER BY COUNT( * ) DESC LIMIT 1 );
human
What is the sex of the students in this major?
assistant
SELECT sex FROM student WHERE major = ( SELECT major FROM Student GROUP BY major ORDER BY COUNT( * ) DESC LIMIT 1 ) ;