human
Schema:
gymnast (Gymnast_ID, Floor_Exercise_Points, Pommel_Horse_Points, Rings_Points, Vault_Points, Parallel_Bars_Points, Horizontal_Bar_Points, Total_Points)
people (People_ID, Name, Age, Height, Hometown)
Please answer with SQL.
assistant
Sure, I understand.
human
What is the average horizontal bar points for all gymnasts?
assistant
SELECT avg(Horizontal_Bar_Points) FROM gymnast
human
List the total points of gymnasts in descending order.
assistant
SELECT Total_Points FROM gymnast ORDER BY Total_Points DESC
human
How many gymnasts are there?
assistant
SELECT count(*) FROM gymnast
human
What is the total point count of the youngest gymnast?
assistant
SELECT T1.Total_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T2.Age ASC LIMIT 1
human
Show the ages of gymnasts in descending order of total points.
assistant
SELECT T2.Age FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC
human
Return the average age across all gymnasts.
assistant
SELECT avg ( T2.Age ) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ;