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
Show the minimum, average, and maximum age of all students.
assistant
SELECT min(age) , avg(age) , max(age) FROM Student
human
Show student ids for all male students.
assistant
SELECT StuID FROM Student WHERE Sex = 'M'
human
Show all ages and corresponding number of students.
assistant
SELECT age , count(*) FROM Student GROUP BY age
human
Show the average age for male and female students.
assistant
SELECT avg(age) , sex FROM Student GROUP BY sex
human
Show first name and last name for all students.
assistant
SELECT Fname , Lname FROM Student
human
Show first name, last name, age for all female students. Their sex is F.
assistant
SELECT Fname , Lname , Age FROM Student WHERE Sex = "F" ;