Database: climbing

Question: How many climbers are there?
SQL: SELECT count(*) FROM climber

Question: List the names of climbers in descending order of points.
SQL: SELECT Name FROM climber ORDER BY Points DESC

Question: List the names of climbers whose country is not Switzerland.
SQL: SELECT Name FROM climber WHERE Country != "Switzerland"

Question: What is the maximum point for climbers whose country is United Kingdom?
SQL: SELECT max(Points) FROM climber WHERE Country  =  "United Kingdom"

Question: How many distinct countries are the climbers from?
SQL: SELECT COUNT(DISTINCT Country) FROM climber

Question: What are the names of mountains in ascending alphabetical order?
SQL: SELECT Name FROM mountain ORDER BY Name ASC

Question: What are the countries of mountains with height bigger than 5000?
SQL: SELECT Country FROM mountain WHERE Height  >  5000

Question: What is the name of the highest mountain?
SQL: SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1

Question: List the distinct ranges of the mountains with the top 3 prominence.
SQL: SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3

Question: Show names of climbers and the names of mountains they climb.
SQL: SELECT T1.Name ,  T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID  =  T2.Mountain_ID

Question: Show the names of climbers and the heights of mountains they climb.
SQL: SELECT T1.Name ,  T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID  =  T2.Mountain_ID

Question: Show the height of the mountain climbed by the climber with the maximum points.
SQL: SELECT T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID  =  T2.Mountain_ID ORDER BY T1.Points DESC LIMIT 1

Question: Show the distinct names of mountains climbed by climbers from country "West Germany".
SQL: SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID  =  T2.Mountain_ID WHERE T1.Country  =  "West Germany"

Question: Show the times used by climbers to climb mountains in Country Uganda.
SQL: SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID  =  T2.Mountain_ID WHERE T2.Country  =  "Uganda"

Question: Please show the countries and the number of climbers from each country.
SQL: SELECT Country ,  COUNT(*) FROM climber GROUP BY Country

Question: List the countries that have more than one mountain.
SQL: SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*)  >  1

Question: List the names of mountains that do not have any climber.
SQL: SELECT Name FROM mountain WHERE Mountain_ID NOT IN (SELECT Mountain_ID FROM climber)

Question: Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200.
SQL: SELECT Country FROM mountain WHERE Height  >  5600 INTERSECT SELECT Country FROM mountain WHERE Height  <  5200

Question: Show the range that has the most number of mountains.
SQL: SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1