human
Schema:
Student (StuID, LName, Fname, Age, Sex, Major, Advisor, city_code)
Club (ClubID, ClubName, ClubDesc, ClubLocation)
Member_of_club (StuID, ClubID, Position)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the average age of students?
assistant
SELECT AVG ( Age ) FROM Student;
human
And what is the average gender wise? | sorry,i cant understand your question | What is the average age of students as per the 'Sex' of the students?
assistant
SELECT sex , AVG ( Age ) FROM student GROUP by Sex;
human
How many Students are below the age of 17?
assistant
SELECT COUNT( StuID ) FROM student WHERE Age < 17;
human
How many students have the same Fname?
assistant
SELECT COUNT( StuID ) FROM student WHERE Fname IN ( SELECT Fname FROM student GROUP by Fname having COUNT( * ) > 1 );
human
How many clubs are located in city code 'AKW
assistant
SELECT COUNT( ClubID ) FROM Club WHERE ClubLocation = "AKW" ;