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 is the average age of female (sex is F) students?
assistant
SELECT avg(Age) FROM STUDENT WHERE Sex = 'F'
human
Which major has the most students?
assistant
SELECT Major FROM STUDENT GROUP BY major ORDER BY count(*) DESC LIMIT 1
human
Find the maximum age of all the students.
assistant
SELECT max(Age) FROM STUDENT
human
Find the first names of students with age above 22.
assistant
SELECT Fname FROM STUDENT WHERE Age > 22
human
Find the last names of students with major 50.
assistant
SELECT LName FROM STUDENT WHERE Major = 50
human
Tell me the ages of the oldest and youngest students studying major 600.
assistant
SELECT MAX( Age ) , MIN( Age ) FROM STUDENT WHERE Major = 600 ;