SQL
stringlengths 18
577
| question
stringlengths 317
11.5k
|
---|---|
SELECT College FROM match_season GROUP BY College HAVING count(*) >= 2 | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Show the name of colleges that have at least two players. |
SELECT College FROM match_season GROUP BY College HAVING count(*) >= 2 | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. What are the names of all colleges that have two or more players? |
SELECT College FROM match_season GROUP BY College HAVING count(*) >= 2 ORDER BY College DESC | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Show the name of colleges that have at least two players in descending alphabetical order. |
SELECT College FROM match_season GROUP BY College HAVING count(*) >= 2 ORDER BY College DESC | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. What are the names of colleges that have two or more players, listed in descending alphabetical order? |
SELECT Name FROM team WHERE Team_id NOT IN (SELECT Team FROM match_season) | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. What are the names of teams that do no have match season record? |
SELECT Name FROM team WHERE Team_id NOT IN (SELECT Team FROM match_season) | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Return the names of teams that have no match season record. |
SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Forward" INTERSECT SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Defender" | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. What are the names of countries that have both players with position forward and players with position defender? |
SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Forward" INTERSECT SELECT T1.Country_name FROM country AS T1 JOIN match_season AS T2 ON T1.Country_id = T2.Country WHERE T2.Position = "Defender" | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Return the names of countries that have players that play the Forward position, as well as players who play the Defender position. |
SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender" | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Which college have both players with position midfielder and players with position defender? |
SELECT College FROM match_season WHERE POSITION = "Midfielder" INTERSECT SELECT College FROM match_season WHERE POSITION = "Defender" | Given the Table country having columns as Country_id has datatype number, Country_name has datatype text, Capital has datatype text, Official_native_language has datatype text which has Country_id and Given the Table team having columns as Team_id has datatype number, Name has datatype text which has Team_id and Given the Table match season having columns as Season has datatype number, Player has datatype text, Position has datatype text, Country has datatype number, Team has datatype number, Draft_Pick_Number has datatype number, Draft_Class has datatype text, College has datatype text which has Season and Given the Table player having columns as Player_ID has datatype number, Player has datatype text, Years_Played has datatype text, Total_WL has datatype text, Singles_WL has datatype text, Doubles_WL has datatype text, Team has datatype number which has Player_ID. Answer the question by writing the appropriate SQL code. Return the colleges that have players who play the Midfielder position, as well as players who play the Defender position. |
SELECT count(*) FROM climber | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. How many climbers are there? |
SELECT count(*) FROM climber | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Count the number of climbers. |
SELECT Name FROM climber ORDER BY Points DESC | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. List the names of climbers in descending order of points. |
SELECT Name FROM climber ORDER BY Points DESC | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of the climbers, ordered by points descending? |
SELECT Name FROM climber WHERE Country != "Switzerland" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. List the names of climbers whose country is not Switzerland. |
SELECT Name FROM climber WHERE Country != "Switzerland" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of climbers who are not from the country of Switzerland? |
SELECT max(Points) FROM climber WHERE Country = "United Kingdom" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What is the maximum point for climbers whose country is United Kingdom? |
SELECT max(Points) FROM climber WHERE Country = "United Kingdom" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Return the maximum number of points for climbers from the United Kingdom. |
SELECT COUNT(DISTINCT Country) FROM climber | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. How many distinct countries are the climbers from? |
SELECT COUNT(DISTINCT Country) FROM climber | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Count the number of different countries that climbers are from. |
SELECT Name FROM mountain ORDER BY Name ASC | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of mountains in ascending alphabetical order? |
SELECT Name FROM mountain ORDER BY Name ASC | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Give the names of mountains in alphabetical order. |
SELECT Country FROM mountain WHERE Height > 5000 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the countries of mountains with height bigger than 5000? |
SELECT Country FROM mountain WHERE Height > 5000 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Return the countries of the mountains that have a height larger than 5000. |
SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What is the name of the highest mountain? |
SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Return the name of the mountain with the greatest height. |
SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. List the distinct ranges of the mountains with the top 3 prominence. |
SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the different ranges of the 3 mountains with the highest prominence? |
SELECT T1.Name , T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show names of climbers and the names of mountains they climb. |
SELECT T1.Name , T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of climbers and the corresponding names of mountains that they climb? |
SELECT T1.Name , T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the names of climbers and the heights of mountains they climb. |
SELECT T1.Name , T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of climbers and the corresponding heights of the mountains that they climb? |
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 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the height of the mountain climbed by the climber with the maximum points. |
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 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What is the height of the mountain climbined by the climbing who had the most points? |
SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the distinct names of mountains climbed by climbers from country "West Germany". |
SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the different names of mountains ascended by climbers from the country of West Germany? |
SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = "Uganda" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the times used by climbers to climb mountains in Country Uganda. |
SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = "Uganda" | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the times used by climbers who climbed mountains in the country of Uganda? |
SELECT Country , COUNT(*) FROM climber GROUP BY Country | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Please show the countries and the number of climbers from each country. |
SELECT Country , COUNT(*) FROM climber GROUP BY Country | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. How many climbers are from each country? |
SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. List the countries that have more than one mountain. |
SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Which countries have more than one mountain? |
SELECT Name FROM mountain WHERE Mountain_ID NOT IN (SELECT Mountain_ID FROM climber) | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. List the names of mountains that do not have any climber. |
SELECT Name FROM mountain WHERE Mountain_ID NOT IN (SELECT Mountain_ID FROM climber) | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of countains that no climber has climbed? |
SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200. |
SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the countries that have both mountains that are higher than 5600 and lower than 5200? |
SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the range that has the most number of mountains. |
SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Which range contains the most mountains? |
SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. Show the names of mountains with height more than 5000 or prominence more than 1000. |
SELECT Name FROM mountain WHERE Height > 5000 OR Prominence > 1000 | Given the Table mountain having columns as Mountain_ID has datatype number, Name has datatype text, Height has datatype number, Prominence has datatype number, Range has datatype text, Country has datatype text which has Mountain_ID and Given the Table climber having columns as Climber_ID has datatype number, Name has datatype text, Country has datatype text, Time has datatype text, Points has datatype number, Mountain_ID has datatype number which has Climber_ID. Answer the question by writing the appropriate SQL code. What are the names of mountains that have a height of over 5000 or a prominence of over 1000? |
SELECT count(*) FROM body_builder | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. How many body builders are there? |
SELECT Total FROM body_builder ORDER BY Total ASC | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List the total scores of body builders in ascending order. |
SELECT Snatch , Clean_Jerk FROM body_builder ORDER BY Snatch ASC | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List the snatch score and clean jerk score of body builders in ascending order of snatch score. |
SELECT avg(Snatch) FROM body_builder | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What is the average snatch score of body builders? |
SELECT Clean_Jerk FROM body_builder ORDER BY Total DESC LIMIT 1 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the clean and jerk score of the body builder with the highest total score? |
SELECT Birth_Date FROM People ORDER BY Height ASC | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the birthdays of people in ascending order of height? |
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of body builders? |
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total > 300 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of body builders whose total score is higher than 300? |
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T2.Weight DESC LIMIT 1 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What is the name of the body builder with the greatest body weight? |
SELECT T2.Birth_Date , T2.Birth_Place FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC LIMIT 1 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the birth date and birth place of the body builder with the highest total points? |
SELECT T2.Height FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T1.Total < 315 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the heights of body builders with total score smaller than 315? |
SELECT avg(T1.Total) FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID WHERE T2.Height > 200 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What is the average total score of body builders with height bigger than 200? |
SELECT T2.Name FROM body_builder AS T1 JOIN people AS T2 ON T1.People_ID = T2.People_ID ORDER BY T1.Total DESC | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the names of body builders in descending order of total scores? |
SELECT Birth_Place , COUNT(*) FROM people GROUP BY Birth_Place | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List each birth place along with the number of people from there. |
SELECT Birth_Place FROM people GROUP BY Birth_Place ORDER BY COUNT(*) DESC LIMIT 1 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What is the most common birth place of people? |
SELECT Birth_Place FROM people GROUP BY Birth_Place HAVING COUNT(*) >= 2 | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the birth places that are shared by at least two people? |
SELECT Height , Weight FROM people ORDER BY Height DESC | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List the height and weight of people in descending order of height. |
SELECT * FROM body_builder | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. Show all information about each body builder. |
SELECT Name , birth_place FROM people EXCEPT SELECT T1.Name , T1.birth_place FROM people AS T1 JOIN body_builder AS T2 ON T1.people_id = T2.people_id | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List the names and origins of people who are not body builders. |
SELECT count(DISTINCT Birth_Place) FROM people | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. How many distinct birth places are there? |
SELECT count(*) FROM people WHERE people_id NOT IN (SELECT People_ID FROM body_builder) | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. How many persons are not body builders? |
SELECT T2.weight FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T1.snatch > 140 OR T2.height > 200; | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. List the weight of the body builders who have snatch score higher than 140 or have the height greater than 200. |
SELECT T1.total FROM body_builder AS T1 JOIN people AS T2 ON T1.people_id = T2.people_id WHERE T2.Birth_Date LIKE "%January%"; | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What are the total scores of the body builders whose birthday contains the string "January" ? |
SELECT min(snatch) FROM body_builder | Given the Table body builder having columns as Body_Builder_ID has datatype number, People_ID has datatype number, Snatch has datatype number, Clean_Jerk has datatype number, Total has datatype number which has Body_Builder_ID and Given the Table people having columns as People_ID has datatype number, Name has datatype text, Height has datatype number, Weight has datatype number, Birth_Date has datatype text, Birth_Place has datatype text which has People_ID. Answer the question by writing the appropriate SQL code. What is the minimum snatch score? |
SELECT count(*) FROM election | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. How many elections are there? |
SELECT Votes FROM election ORDER BY Votes DESC | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. List the votes of elections in descending order. |
SELECT Date , Vote_Percent FROM election | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. List the dates and vote percents of elections. |
SELECT min(Vote_Percent) , max(Vote_Percent) FROM election | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the minimum and maximum vote percents of elections? |
SELECT Name , Party FROM representative | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the names and parties of representatives? |
SELECT Name FROM Representative WHERE Party != "Republican" | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the names of representatives whose party is not "Republican"? |
SELECT Lifespan FROM representative WHERE State = "New York" OR State = "Indiana" | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the life spans of representatives from New York state or Indiana state? |
SELECT T2.Name , T1.Date FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the names of representatives and the dates of elections they participated in. |
SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE Votes > 10000 | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the names of representatives with more than 10000 votes in election? |
SELECT T2.Name FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes DESC | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the names of representatives in descending order of votes? |
SELECT T2.Party FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY votes ASC LIMIT 1 | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What is the party of the representative that has the smallest number of votes. |
SELECT T2.Lifespan FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID ORDER BY Vote_Percent DESC | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the lifespans of representatives in descending order of vote percent? |
SELECT avg(T1.Votes) FROM election AS T1 JOIN representative AS T2 ON T1.Representative_ID = T2.Representative_ID WHERE T2.Party = "Republican" | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What is the average number of votes of representatives from party "Republican"? |
SELECT Party , COUNT(*) FROM representative GROUP BY Party | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What are the different parties of representative? Show the party name and the number of representatives in each party. |
SELECT Party , COUNT(*) FROM representative GROUP BY Party ORDER BY COUNT(*) DESC LIMIT 1 | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What is the party that has the largest number of representatives? |
SELECT Party FROM representative GROUP BY Party HAVING COUNT(*) >= 3 | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What parties have at least three representatives? |
SELECT State FROM representative GROUP BY State HAVING COUNT(*) >= 2 | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. What states have at least two representatives? |
SELECT Name FROM representative WHERE Representative_ID NOT IN (SELECT Representative_ID FROM election) | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. List the names of representatives that have not participated in elections listed here. |
SELECT Party FROM representative WHERE State = "New York" INTERSECT SELECT Party FROM representative WHERE State = "Pennsylvania" | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. Show the parties that have both representatives in New York state and representatives in Pennsylvania state. |
SELECT count(DISTINCT Party) FROM representative | Given the Table election having columns as Election_ID has datatype number, Representative_ID has datatype number, Date has datatype text, Votes has datatype number, Vote_Percent has datatype number, Seats has datatype number, Place has datatype number which has Election_ID and Given the Table representative having columns as Representative_ID has datatype number, Name has datatype text, State has datatype text, Party has datatype text, Lifespan has datatype text which has Representative_ID. Answer the question by writing the appropriate SQL code. How many distinct parties are there for representatives? |
SELECT count(*) FROM Apartment_Bookings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. How many apartment bookings are there in total? |
SELECT count(*) FROM Apartment_Bookings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Count the total number of apartment bookings. |
SELECT booking_start_date , booking_end_date FROM Apartment_Bookings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show the start dates and end dates of all the apartment bookings. |
SELECT booking_start_date , booking_end_date FROM Apartment_Bookings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. What are the start date and end date of each apartment booking? |
SELECT DISTINCT building_description FROM Apartment_Buildings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Show all distinct building descriptions. |
SELECT DISTINCT building_description FROM Apartment_Buildings | Given the Table apartment buildings having columns as building_id has datatype number, building_short_name has datatype text, building_full_name has datatype text, building_description has datatype text, building_address has datatype text, building_manager has datatype text, building_phone has datatype text which has building_id and Given the Table apartments having columns as apt_id has datatype number, building_id has datatype number, apt_type_code has datatype text, apt_number has datatype text, bathroom_count has datatype number, bedroom_count has datatype number, room_count has datatype text which has apt_id and Given the Table apartment facilities having columns as apt_id has datatype number, facility_code has datatype text which has apt_id and Given the Table guests having columns as guest_id has datatype number, gender_code has datatype text, guest_first_name has datatype text, guest_last_name has datatype text, date_of_birth has datatype time which has guest_id and Given the Table apartment bookings having columns as apt_booking_id has datatype number, apt_id has datatype number, guest_id has datatype number, booking_status_code has datatype text, booking_start_date has datatype time, booking_end_date has datatype time which has apt_booking_id and Given the Table view unit status having columns as apt_id has datatype number, apt_booking_id has datatype number, status_date has datatype time, available_yn has datatype others which has status_date. Answer the question by writing the appropriate SQL code. Give me a list of all the distinct building descriptions. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.