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
Find the maximum age of all the students.
assistant
SELECT max(Age) FROM STUDENT
human
What are the maximum and minimum age of students with major 600?
assistant
SELECT max(Age) , min(Age) FROM STUDENT WHERE Major = 600
human
What are the majors of male (sex is M) students?
assistant
SELECT Major FROM STUDENT WHERE Sex = 'M'
human
Find the average age of female (sex is F) students who have secretary votes in the spring election cycle.
assistant
SELECT avg(T1.Age) FROM STUDENT AS T1 JOIN VOTING_RECORD AS T2 ON T1.StuID = SECRETARY_Vote WHERE T1.Sex = 'F' AND T2.Election_Cycle = 'Spring'
human
What is the most common major among female (sex is F) students?
assistant
SELECT Major FROM STUDENT WHERE Sex = 'F' GROUP BY major ORDER BY count(*) DESC LIMIT 1
human
What is the average age of female (sex is F) students?
assistant
SELECT avg ( Age ) FROM STUDENT WHERE Sex = "F" ;