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
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
Show their names.
assistant
SELECT T2.Name FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID ORDER BY T1.Total_Points DESC;
human
What is the height of Paul Hamm?
assistant
SELECT Height FROM people WHERE name = 'Paul Hamm';
human
What is his hometown?
assistant
SELECT Hometown FROM people WHERE name = 'Paul Hamm';
human
How many total points does he have?
assistant
SELECT SUM( Total_Points ) FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE t2.Name = 'Paul Hamm';
human
How many rings points does he have?
assistant
SELECT Rings_Points FROM gymnast AS T1 JOIN people AS T2 ON T1.Gymnast_ID = T2.People_ID WHERE t2.Name = "Paul Hamm" ;