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 all students.
assistant
SELECT AVG ( age ) FROM STUDENT;
human
Which student is older than the average age. | Do you want their id or last name or first name? | The first name for the student older than the average age.
assistant
SELECT fname FROM student WHERE age > ( SELECT AVG ( age ) FROM STUDENT );
human
Give me the count for the students older than the average age.
assistant
SELECT COUNT( fname ) FROM student WHERE age > ( SELECT AVG ( age ) FROM STUDENT ) ;