database_id
stringlengths
4
31
query
stringlengths
22
577
question
stringlengths
19
224
bike_1
SELECT start_station_name , end_station_name FROM trip ORDER BY id LIMIT 3
Give me the start station and end station for the trips with the three oldest ids.
bike_1
SELECT avg(lat) , avg(long) FROM station WHERE city = "San Jose"
What is the average latitude and longitude of stations located in San Jose city?
bike_1
SELECT id FROM trip ORDER BY duration LIMIT 1
What is the id of the trip that has the shortest duration?
bike_1
SELECT sum(duration) , max(duration) FROM trip WHERE bike_id = 636
What is the total and maximum duration of trips with bike id 636?
bike_1
SELECT zip_code , avg(mean_temperature_f) FROM weather WHERE date LIKE "8/%" GROUP BY zip_code
For each zip code, return the average mean temperature of August there.
bike_1
SELECT DISTINCT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available = 7
Return the unique name for stations that have ever had 7 bikes available.
bike_1
SELECT start_station_name , start_station_id FROM trip WHERE start_date LIKE "8/%" GROUP BY start_station_name ORDER BY COUNT(*) DESC LIMIT 1
Which start station had the most trips starting from August? Give me the name and id of the station.
bike_1
SELECT bike_id FROM trip WHERE zip_code = 94002 GROUP BY bike_id ORDER BY COUNT(*) DESC LIMIT 1
Which bike traveled the most often in zip code 94002?
bike_1
SELECT COUNT(*) FROM weather WHERE mean_humidity > 50 AND mean_visibility_miles > 8
How many days had both mean humidity above 50 and mean visibility above 8?
bike_1
SELECT T1.lat , T1.long , T1.city FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id ORDER BY T2.duration LIMIT 1
What is the latitude, longitude, city of the station from which the shortest trip started?
bike_1
SELECT id FROM station WHERE city = "San Francisco" INTERSECT SELECT station_id FROM status GROUP BY station_id HAVING avg(bikes_available) > 10
What are the ids of stations that are located in San Francisco and have average bike availability above 10.
bike_1
SELECT T1.name , T1.id FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING avg(T2.bikes_available) > 14 UNION SELECT name , id FROM station WHERE installation_date LIKE "12/%"
What are the names and ids of stations that had more than 14 bikes available on average or were installed in December?
bike_1
SELECT cloud_cover FROM weather WHERE zip_code = 94107 GROUP BY cloud_cover ORDER BY COUNT (*) DESC LIMIT 3
What is the 3 most common cloud cover rates in the region of zip code 94107?
bike_1
SELECT zip_code FROM weather GROUP BY zip_code ORDER BY avg(mean_sea_level_pressure_inches) LIMIT 1
What is the zip code in which the average mean sea level pressure is the lowest?
bike_1
SELECT avg(bikes_available) FROM status WHERE station_id NOT IN (SELECT id FROM station WHERE city = "Palo Alto")
What is the average bike availability in stations that are not located in Palo Alto?
bike_1
SELECT avg(long) FROM station WHERE id NOT IN (SELECT station_id FROM status GROUP BY station_id HAVING max(bikes_available) > 10)
What is the average longitude of stations that never had bike availability more than 10?
bike_1
SELECT T1.id FROM trip AS T1 JOIN weather AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.zip_code HAVING avg(T2.mean_temperature_f) > 60
Give me ids for all the trip that took place in a zip code area with average mean temperature above 60.
bike_1
SELECT zip_code , count(*) FROM weather WHERE max_wind_Speed_mph >= 25 GROUP BY zip_code
For each zip code, return how many times max wind speed reached 25?
bike_1
SELECT date , zip_code FROM weather WHERE min_dew_point_f < (SELECT min(min_dew_point_f) FROM weather WHERE zip_code = 94107)
On which day and in which zip code was the min dew point lower than any day in zip code 94107?
bike_1
SELECT T1.id FROM trip AS T1 JOIN station AS T2 ON T1.start_station_id = T2.id ORDER BY T2.dock_count DESC LIMIT 1
Which trip started from the station with the largest dock count? Give me the trip id.
bike_1
SELECT count(*) FROM trip AS T1 JOIN station AS T2 ON T1.end_station_id = T2.id WHERE T2.city != "San Francisco"
Count the number of trips that did not end in San Francisco city.
bike_1
SELECT date FROM weather WHERE zip_code = 94107 AND EVENTS != "Fog" AND EVENTS != "Rain"
In zip code 94107, on which day neither Fog nor Rain was observed?
bike_1
SELECT id FROM station WHERE lat > 37.4 EXCEPT SELECT station_id FROM status GROUP BY station_id HAVING min(bikes_available) < 7
What are the ids of stations that have latitude above 37.4 and never had bike availability below 7?
bike_1
SELECT T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id GROUP BY T2.station_id HAVING avg(bikes_available) > 10 EXCEPT SELECT name FROM station WHERE city = "San Jose"
What are names of stations that have average bike availability above 10 and are not located in San Jose city?
bike_1
SELECT name , lat , city FROM station ORDER BY lat LIMIT 1
What are the name, latitude, and city of the station with the lowest latitude?
bike_1
SELECT date , mean_temperature_f , mean_humidity FROM weather ORDER BY max_gust_speed_mph DESC LIMIT 3
What are the date, mean temperature and mean humidity for the top 3 days with the largest max gust speeds?
bike_1
SELECT city , COUNT(*) FROM station GROUP BY city HAVING COUNT(*) >= 15
List the name and the number of stations for all the cities that have at least 15 stations.
bike_1
SELECT start_station_id , start_station_name FROM trip GROUP BY start_station_id HAVING COUNT(*) >= 200
Find the ids and names of stations from which at least 200 trips started.
bike_1
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_visibility_miles) < 10
Find the zip code in which the average mean visibility is lower than 10.
bike_1
SELECT city FROM station GROUP BY city ORDER BY max(lat) DESC
List all the cities in a decreasing order of each city's stations' highest latitude.
bike_1
SELECT date , cloud_cover FROM weather ORDER BY cloud_cover DESC LIMIT 5
What are the dates that had the top 5 cloud cover rates? Also tell me the cloud cover rate.
bike_1
SELECT id , duration FROM trip ORDER BY duration DESC LIMIT 3
What are the ids and durations of the trips with the top 3 durations?
bike_1
SELECT T1.name , T1.long , avg(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.start_station_id GROUP BY T2.start_station_id
For each station, return its longitude and the average duration of trips that started from the station.
bike_1
SELECT T1.name , T1.lat , min(T2.duration) FROM station AS T1 JOIN trip AS T2 ON T1.id = T2.end_station_id GROUP BY T2.end_station_id
For each station, find its latitude and the minimum duration of trips that ended at the station.
bike_1
SELECT DISTINCT zip_code FROM weather EXCEPT SELECT DISTINCT zip_code FROM weather WHERE max_dew_point_f >= 70
Find all the zip codes in which the max dew point have never reached 70.
bike_1
SELECT id FROM trip WHERE duration >= (SELECT avg(duration) FROM trip WHERE zip_code = 94103)
Find the id for the trips that lasted at least as long as the average duration of trips in zip code 94103.
bike_1
SELECT date , max_temperature_f - min_temperature_f FROM weather ORDER BY max_temperature_f - min_temperature_f LIMIT 1
Find the day in which the difference between the max temperature and min temperature was the smallest. Also report the difference.
bike_1
SELECT DISTINCT T1.id , T1.name FROM station AS T1 JOIN status AS T2 ON T1.id = T2.station_id WHERE T2.bikes_available > 12
What are the id and name of the stations that have ever had more than 12 bikes available?
bike_1
SELECT zip_code FROM weather GROUP BY zip_code HAVING avg(mean_humidity) < 70 INTERSECT SELECT zip_code FROM trip GROUP BY zip_code HAVING count(*) >= 100
Give me the zip code where the average mean humidity is below 70 and at least 100 trips took place.
bike_1
SELECT name FROM station WHERE city = "Palo Alto" EXCEPT SELECT end_station_name FROM trip GROUP BY end_station_name HAVING count(*) > 100
What are the names of stations that are located in Palo Alto city but have never been the ending point of trips more than 100 times?
bike_1
SELECT count(*) FROM station AS T1 JOIN trip AS T2 JOIN station AS T3 JOIN trip AS T4 ON T1.id = T2.start_station_id AND T2.id = T4.id AND T3.id = T4.end_station_id WHERE T1.city = "Mountain View" AND T3.city = "Palo Alto"
How many trips started from Mountain View city and ended at Palo Alto city?
riding_club
SELECT count(*) FROM player
How many players are there?
riding_club
SELECT Player_name FROM player ORDER BY Votes ASC
List the names of players in ascending order of votes.
riding_club
SELECT Gender , Occupation FROM player
What are the gender and occupation of players?
riding_club
SELECT Player_name , residence FROM player WHERE Occupation != "Researcher"
List the name and residence for players whose occupation is not "Researcher".
riding_club
SELECT Sponsor_name FROM player WHERE Residence = "Brandon" OR Residence = "Birtle"
Show the names of sponsors of players whose residence is either "Brandon" or "Birtle".
riding_club
SELECT Player_name FROM player ORDER BY Votes DESC LIMIT 1
What is the name of the player with the largest number of votes?
riding_club
SELECT Occupation , COUNT(*) FROM player GROUP BY Occupation
Show different occupations along with the number of players in each occupation.
riding_club
SELECT Occupation FROM player GROUP BY Occupation ORDER BY COUNT(*) DESC LIMIT 1
Please show the most common occupation of players.
riding_club
SELECT Residence FROM player GROUP BY Residence HAVING COUNT(*) >= 2
Show the residences that have at least two players.
riding_club
SELECT T3.Player_name , T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID
Show the names of players and names of their coaches.
riding_club
SELECT T3.Player_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T2.Rank = 1
Show the names of players coached by the rank 1 coach.
riding_club
SELECT T3.Player_name , T3.gender FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID WHERE T1.Starting_year > 2011
Show the names and genders of players with a coach starting after 2011.
riding_club
SELECT T3.Player_name , T2.coach_name FROM player_coach AS T1 JOIN coach AS T2 ON T1.Coach_ID = T2.Coach_ID JOIN player AS T3 ON T1.Player_ID = T3.Player_ID ORDER BY T3.Votes DESC
Show the names of players and names of their coaches in descending order of the votes of players.
riding_club
SELECT Player_name FROM player WHERE Player_ID NOT IN (SELECT Player_ID FROM player_coach)
List the names of players that do not have coaches.
riding_club
SELECT Residence FROM player WHERE gender = "M" INTERSECT SELECT Residence FROM player WHERE gender = "F"
Show the residences that have both a player of gender "M" and a player of gender "F".
riding_club
SELECT T1.club_id , T1.club_name, count(*) FROM club AS T1 JOIN coach AS T2 ON T1.club_id = T2.club_id GROUP BY T1.club_id
How many coaches does each club has? List the club id, name and the number of coaches.
railway
SELECT count(*) FROM railway
How many railways are there?
railway
SELECT Builder FROM railway ORDER BY Builder ASC
List the builders of railways in ascending alphabetical order.
railway
SELECT Wheels , LOCATION FROM railway
List the wheels and locations of the railways.
railway
SELECT max(LEVEL) FROM manager WHERE Country != "Australia "
What is the maximum level of managers in countries that are not "Australia"?
railway
SELECT avg(Age) FROM manager
What is the average age for all managers?
railway
SELECT Name FROM manager ORDER BY LEVEL ASC
What are the names of managers in ascending order of level?
railway
SELECT Name , Arrival FROM train
What are the names and arrival times of trains?
railway
SELECT Name FROM manager ORDER BY Age DESC LIMIT 1
What is the name of the oldest manager?
railway
SELECT T2.Name , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID
Show the names of trains and locations of railways they are in.
railway
SELECT T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID WHERE T2.Name = "Andaman Exp"
Show the builder of railways associated with the trains named "Andaman Exp".
railway
SELECT T2.Railway_ID , T1.Location FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID HAVING COUNT(*) > 1
Show id and location of railways that are associated with more than one train.
railway
SELECT T2.Railway_ID , T1.Builder FROM railway AS T1 JOIN train AS T2 ON T1.Railway_ID = T2.Railway_ID GROUP BY T2.Railway_ID ORDER BY COUNT(*) DESC LIMIT 1
Show the id and builder of the railway that are associated with the most trains.
railway
SELECT Builder , COUNT(*) FROM railway GROUP BY Builder
Show different builders of railways, along with the corresponding number of railways using each builder.
railway
SELECT Builder FROM railway GROUP BY Builder ORDER BY COUNT(*) DESC LIMIT 1
Show the most common builder of railways.
railway
SELECT LOCATION , COUNT(*) FROM railway GROUP BY LOCATION
Show different locations of railways along with the corresponding number of railways at each location.
railway
SELECT LOCATION FROM railway GROUP BY LOCATION HAVING COUNT(*) > 1
Show the locations that have more than one railways.
railway
SELECT ObjectNumber FROM railway WHERE Railway_ID NOT IN (SELECT Railway_ID FROM train)
List the object number of railways that do not have any trains.
railway
SELECT Country FROM manager WHERE Age > 50 INTERSECT SELECT Country FROM manager WHERE Age < 46
Show the countries that have both managers of age above 50 and managers of age below 46.
railway
SELECT DISTINCT Country FROM manager
Show the distinct countries of managers.
railway
SELECT Working_year_starts FROM manager ORDER BY LEVEL DESC
Show the working years of managers in descending order of their level.
climbing
SELECT count(*) FROM climber
How many climbers are there?
climbing
SELECT Name FROM climber ORDER BY Points DESC
List the names of climbers in descending order of points.
climbing
SELECT Name FROM climber WHERE Country != "Switzerland"
List the names of climbers whose country is not Switzerland.
climbing
SELECT max(Points) FROM climber WHERE Country = "United Kingdom"
What is the maximum point for climbers whose country is United Kingdom?
climbing
SELECT COUNT(DISTINCT Country) FROM climber
How many distinct countries are the climbers from?
climbing
SELECT Name FROM mountain ORDER BY Name ASC
What are the names of mountains in ascending alphabetical order?
climbing
SELECT Country FROM mountain WHERE Height > 5000
What are the countries of mountains with height bigger than 5000?
climbing
SELECT Name FROM mountain ORDER BY Height DESC LIMIT 1
What is the name of the highest mountain?
climbing
SELECT DISTINCT Range FROM mountain ORDER BY Prominence DESC LIMIT 3
List the distinct ranges of the mountains with the top 3 prominence.
climbing
SELECT T1.Name , T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID
Show names of climbers and the names of mountains they climb.
climbing
SELECT T1.Name , T2.Height FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID
Show the names of climbers and the heights of mountains they climb.
climbing
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
Show the height of the mountain climbed by the climber with the maximum points.
climbing
SELECT DISTINCT T2.Name FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T1.Country = "West Germany"
Show the distinct names of mountains climbed by climbers from country "West Germany".
climbing
SELECT T1.Time FROM climber AS T1 JOIN mountain AS T2 ON T1.Mountain_ID = T2.Mountain_ID WHERE T2.Country = "Uganda"
Show the times used by climbers to climb mountains in Country Uganda.
climbing
SELECT Country , COUNT(*) FROM climber GROUP BY Country
Please show the countries and the number of climbers from each country.
climbing
SELECT Country FROM mountain GROUP BY Country HAVING COUNT(*) > 1
List the countries that have more than one mountain.
climbing
SELECT Name FROM mountain WHERE Mountain_ID NOT IN (SELECT Mountain_ID FROM climber)
List the names of mountains that do not have any climber.
climbing
SELECT Country FROM mountain WHERE Height > 5600 INTERSECT SELECT Country FROM mountain WHERE Height < 5200
Show the countries that have mountains with height more than 5600 stories and mountains with height less than 5200.
climbing
SELECT Range FROM mountain GROUP BY Range ORDER BY COUNT(*) DESC LIMIT 1
Show the range that has the most number of mountains.
device
SELECT count(*) FROM device
How many devices are there?
device
SELECT Carrier FROM device ORDER BY Carrier ASC
List the carriers of devices in ascending alphabetical order.
device
SELECT Carrier FROM device WHERE Software_Platform != 'Android'
What are the carriers of devices whose software platforms are not "Android"?
device
SELECT Shop_Name FROM shop ORDER BY Open_Year ASC
What are the names of shops in ascending order of open year?