problem
stringlengths 121
422
| db_id
stringclasses 69
values | solution
stringlengths 23
804
|
---|---|---|
Write SQL query to solve given problem: What is the average duration of bike trips in the city of Palo Alto?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto' |
Write SQL query to solve given problem: What is the route that has the longest duration? Indicate the city of where the stations are located.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.start_station_name, T1.end_station_name, T2.city FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name ) |
Write SQL query to solve given problem: List the name of stations that were installed from 8/5/2013 to 12/31/2013. Indicate their installation date and city name.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT name, installation_date, city FROM station WHERE (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) = '5' AND SUBSTR(CAST(installation_date AS TEXT), INSTR(installation_date, '/') + 1, -6) >= '8' AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) IN ( '6', '7', '8', '9', '10', '11', '12' ) AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') |
Write SQL query to solve given problem: What is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park' |
Write SQL query to solve given problem: Write down the times when there is no available bike to borrow in a station. List down the stations name and location coordinate.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.time, T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.bikes_available = 0 |
Write SQL query to solve given problem: List down the trips in which their start and end station are similar. Give me their trip IDs and location coordinates.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id, T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = T1.end_station_name |
Write SQL query to solve given problem: On 8/29/2013 at 6:14:01 PM, how many bikes were borrowed from San Jose Diridon Caltrain Station?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(T1.dock_count - T2.bikes_available) FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 06:14:01' |
Write SQL query to solve given problem: List down the trip IDs when bike no. 10 was used by subscribers and the weather's mean temperature is no less than 62 degress Fahrenheit.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.bike_id = 10 AND T2.mean_temperature_f > 62 AND T1.subscription_type = 'Subscriber' |
Write SQL query to solve given problem: What were the max gust speed and cloud clover when the customer using bike no. 10 recorded the 386 seconds duration of the trip from MLK Library to San Salvador at 1st?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.max_gust_speed_mph, T2.cloud_cover FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T1.bike_id = 10 AND T2.mean_temperature_f > 62 AND T1.subscription_type = 'Customer' AND T1.start_station_name = 'MLK Library' AND T1.end_station_name = 'San Salvador at 1st' AND T1.duration = 386 |
Write SQL query to solve given problem: Among the subscriber, how many of them finished the 2nd at Folsom and Civic Center BART (7th at Market) as their start and end stations respectively for no more than 490 seconds under minimum visibility of 4 miles.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.subscription_type = 'Subscriber' AND T2.min_visibility_miles = 4 AND T1.duration < 490 AND T1.start_station_name = '2nd at Folsom' AND T1.end_station_name = 'Civic Center BART (7th at Market)' |
Write SQL query to solve given problem: How many docks were available at the starting station of trip ID 912900?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(T2.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.start_station_id WHERE T1.zip_code = 912900 |
Write SQL query to solve given problem: Please write down the trip IDs which ended on the days when the minimum temperature is less than 45 degrees Fahrenheit.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.min_temperature_f < 45 |
Write SQL query to solve given problem: In 2014, what is the shortest duration of trips by subscribers which started at 2nd at Folsom and ended in the 5th at Howard stations, and by how much shorter than the average? Give me the minimum temperature, maximum gust speed and weather event on that trip.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT MIN(T1.duration) , MIN(T1.duration) - AVG(T1.duration), T2.min_temperature_f FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_date = '1/1/2014 0:00' AND T1.end_date = '12/31/2014 11:59' AND T1.start_station_name = '2nd at Folsom' AND T1.end_station_name = '5th at Howard' AND T1.subscription_type = 'Subscriber' |
Write SQL query to solve given problem: Find the average ride time of the bikes that started at Steuart at Market station and ended at Embarcadero at Sansome station in July 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(duration) FROM trip WHERE start_date = '7/1/2014%' AND end_date = '7/31/2014%' AND start_station_name = 'Steuart at Market' AND end_station_name = 'Embarcadero at Sansome' |
Write SQL query to solve given problem: What are the average maximum and minimum temperatures in May 2015 when the mean humidity is between 65 and 75?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(max_temperature_f), AVG(min_temperature_f) FROM weather WHERE date LIKE '5/%/2015' AND mean_humidity BETWEEN 65 AND 75 |
Write SQL query to solve given problem: Calculate the difference between the number of customers and the number of subscribers who did the trip in June 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(IIF(subscription_type = 'Subscriber', 1, 0)) - SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_date LIKE '6/%/2013%' |
Write SQL query to solve given problem: List the days in 2013 when rain and fog occurred together and find the id of bikes borrowed on these days.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.date, T1.bike_id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2013' AND T2.events = 'Fog-Rain' |
Write SQL query to solve given problem: Find the longest ride on foggy day. What were the mean visibility, mean wind speed, and weather event during that ride? Also, list the coordinates and names of the start and end stations.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T3.mean_visibility_miles, T3.mean_wind_speed_mph, T3.events, T1.lat, T1.long , T2.start_station_name, T2.end_station_name FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.events = 'Fog' ORDER BY T2.duration DESC LIMIT 1 |
Write SQL query to solve given problem: For the rides that started at Market at 10th station and ended at South Van Ness at Market station in August of 2013, which day had the coldest temperature?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.start_date FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T2.date LIKE '8/%/2013' AND T1.start_station_name = 'Market at 10th' AND T1.end_station_name = 'South Van Ness at Market' AND T2.min_temperature_f = ( SELECT MIN(T2.min_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code AND T2.date = SUBSTR(CAST(T1.start_date AS TEXT), 1, INSTR(T1.start_date, ' ') - 1) WHERE T2.date LIKE '8/%/2013' AND T1.start_station_name = 'Market at 10th' AND T1.end_station_name = 'South Van Ness at Market' ) |
Write SQL query to solve given problem: Among the rides during the rainy days, which ride was the longest? List the start station, end station, and duration of this ride.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.start_station_name, T1.end_station_name, T1.duration FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.events = 'Rain' OR T2.events = 'rain' ORDER BY T1.duration DESC LIMIT 1 |
Write SQL query to solve given problem: Find the average ride duration during the rain of more than 0.8 inches.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE (T2.events = 'Rain' AND T2.precipitation_inches > 0.8) OR (T2.events = 'rain' AND T2.precipitation_inches > 0.8) |
Write SQL query to solve given problem: List the name and city of starting stations which has an above-average duration trips.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT T1.start_station_name, T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration > ( SELECT AVG(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name ) |
Write SQL query to solve given problem: How many stations in San Francisco are installed in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(CASE WHEN city = 'San Francisco' AND SUBSTR(installation_date, -4) = '2014' THEN 1 ELSE 0 END) FROM station |
Write SQL query to solve given problem: In 2006, how many trips ended at stations in Mountain View?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T2.city) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T2.city = 'Mountain View' AND T1.start_date LIKE '%2006%' |
Write SQL query to solve given problem: Which trip id had the longest duration and the start station is in Redwood City?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Redwood City' AND T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Redwood City' ) |
Write SQL query to solve given problem: Please list bikes id were used in trips which start station were installed in 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT T1.bike_id FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.installation_date LIKE '%2013' |
Write SQL query to solve given problem: How many trips which subscription types were Subscriber and ended in San Jose city?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.subscription_type) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.end_station_name WHERE T1.subscription_type = 'Subscriber' AND T2.city = 'San Jose' |
Write SQL query to solve given problem: Which trip had the shortest duration and started at the station that can hold 15 bikes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.dock_count = 15 AND T1.duration = ( SELECT MIN(T1.duration) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.dock_count = 15 ) |
Write SQL query to solve given problem: Which year had the most number of trips that started at stations in San Francisco?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUBSTR(CAST(T1.start_date AS TEXT), INSTR(T1.start_date, ' '), -4) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco' GROUP BY T1.start_station_name ORDER BY COUNT(T1.id) DESC LIMIT 1 |
Write SQL query to solve given problem: What is the percentage of trips that started in San Jose and durations were longer than 800 seconds?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(CASE WHEN T1.duration > 800 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Jose' |
Write SQL query to solve given problem: How many trips in 2013 had durations longer than 1000 seconds?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(duration) FROM trip WHERE start_date LIKE '%/%/2013%' AND duration > 1000 |
Write SQL query to solve given problem: Please calculate the average duration of trips started at South Van Ness at Market in 2015.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(duration) FROM trip WHERE start_date LIKE '%2015%' AND start_station_name = 'South Van Ness at Market' |
Write SQL query to solve given problem: How many trips which start station and end station are the same?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(IIF(start_station_id = end_station_id, 1, 0)) FROM trip |
Write SQL query to solve given problem: Please list trips id started on the hottest day.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code ORDER BY T2.max_temperature_f DESC LIMIT 1 |
Write SQL query to solve given problem: Which were the trips that started at Mountain View City Hall and ended on a rainy day?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.id FROM trip AS T1 INNER JOIN weather AS T2 WHERE T2.events = 'Rain' AND T1.start_station_name = 'Mountain View City Hall' |
Write SQL query to solve given problem: What is the average duration of trips that ended on a foggy day?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.events = 'Fog' |
Write SQL query to solve given problem: What was duration of the longest trip started on the day that has a maximum wind speed of 30 mph?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.duration FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.max_wind_Speed_mph = 30 ORDER BY T1.duration DESC LIMIT 1 |
Write SQL query to solve given problem: Please calculate the average temperature of those trips that started at Market at 4th in 2013.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T2.mean_temperature_f) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2013' AND T1.start_station_name = 'Market at 4th' |
Write SQL query to solve given problem: What was the mean humidity of a trip with id 4275?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.mean_humidity FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.id = 4275 |
Write SQL query to solve given problem: In 2015, what percentage of trips that had the subscription type was Customer and ended on a rainy day?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(CASE WHEN T2.events = 'Rain' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2015' AND T1.subscription_type = 'Customer' |
Write SQL query to solve given problem: How many bike stations are installed after August, 2013 in San Jose?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(installation_date) FROM station WHERE city = 'San Jose' AND (SUBSTR(CAST(installation_date AS TEXT), 1, INSTR(installation_date, '/') - 1) IN ('8', '9', '10', '11', '12') AND SUBSTR(CAST(installation_date AS TEXT), -4) = '2013') OR SUBSTR(CAST(installation_date AS TEXT), -4) > '2013' |
Write SQL query to solve given problem: What is the mean temperature in Fahrenheit on 8/29/2013 for the area where the zip code is 94107?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(IIF(zip_code = 94107 AND date = '8/29/2013', mean_temperature_f, 0)) FROM weather |
Write SQL query to solve given problem: What is the difference between the hottest temperature and the coldest temperature in in Fahrenheit on 8/29/2013 for the area where the zip code is 94107?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(IIF(zip_code = 94107 AND date = '8/29/2013', max_temperature_f - min_temperature_f, 0)) FROM weather |
Write SQL query to solve given problem: How many bikes can be borrowed in San Jose Diridon Caltrain Station at 12:06:01 on 2013/8/29?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.bikes_available FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 12:06:01' |
Write SQL query to solve given problem: In which city's station is a bike borrowed on trip ID4069?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069 |
Write SQL query to solve given problem: How many bike trips started on the days in September, 2013 with the hottest temperature over 70 degrees Fahrenheit in the area where the zip code is 94107?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '9/%/2013' AND T2.zip_code = 94107 AND T2.max_temperature_f > 70 |
Write SQL query to solve given problem: Please list the starting stations of the bike trips made on a day with a max humidity over 80 in 2013 in the area where the zip code is 94107.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT T1.start_station_name FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2013' AND T2.zip_code = 94107 AND T2.max_temperature_f > 80 |
Write SQL query to solve given problem: How many trips made by a subscriber started in August, 2013 from a station that can hold more than 20 bikes?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T1.id = T2.start_station_id WHERE T2.subscription_type = 'Subscriber' AND T2.start_date LIKE '8/%/2013%' AND T1.dock_count > 20 |
Write SQL query to solve given problem: What is the location coordinates of the bike station from which the bike for the trip that last the longest was borrowed?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.lat, T2.long FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name ) |
Write SQL query to solve given problem: How many docks were left at the end station for trip ID4069?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(T2.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.end_station_id WHERE T1.ID = 4069 |
Write SQL query to solve given problem: Among the bike trips started on the days with a fog in 2013, how many of those trips started from the station "2nd at Townsend"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T1.start_station_name = '2nd at Townsend' AND T2.zip_code = 94107 |
Write SQL query to solve given problem: What is the longest duration for a bike trip starting on a day with a fog in 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T2.zip_code = 94107 |
Write SQL query to solve given problem: When was the bike station from which the bike was borrowed on trip ID4069 installed?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069 |
Write SQL query to solve given problem: How many trips with a bike borrowed from the stations in San Francisco were made by a subscriber?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN station AS T2 ON T2.ID = T1.start_station_id WHERE T2.city = 'San Francisco' AND T1.subscription_type = 'Subscriber' |
Write SQL query to solve given problem: On the day with the hottest temperature ever in 2014, how many bike trips started from the station 2nd at Folsom?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T2.zip_code = 94107 AND T1.start_station_name = '2nd at Folsom' ORDER BY T2.max_temperature_f DESC LIMIT 1 |
Write SQL query to solve given problem: What is the average duration of a bike trip made on the day with the hottest temperature ever in 2014?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T1.start_station_name = '2nd at Folsom' AND T2.max_temperature_f = ( SELECT max_temperature_f FROM weather ORDER BY max_temperature_f DESC LIMIT 1 ) |
Write SQL query to solve given problem: List out all end stations for a bicycle that were making a trip starting from 2nd at South Park station? Only retain the unique value.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT end_station_name FROM trip WHERE start_station_name = '2nd at South Park' |
Write SQL query to solve given problem: How many rainy days were recorded in Mountain View?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(IIF(zip_code = 94041 AND events = 'Rain', 1, 0)) FROM weather |
Write SQL query to solve given problem: What is the total number of bikes that can be hold in Redwood City before 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(CASE WHEN city = 'Redwood City' AND SUBSTR(installation_date, -4) < '2014' THEN dock_count ELSE 0 END) NUM FROM station |
Write SQL query to solve given problem: What is the longest trip duration according? Convert the it to number of days.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT MAX(duration), CAST(MAX(duration) AS REAL) / 86400 FROM trip |
Write SQL query to solve given problem: Convert all temperature recorded at San Francisco city during August 2013 into degree Celsius.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT (max_temperature_f - 32) / 1.8000 , (mean_temperature_f - 32) / 1.8000 , (min_temperature_f - 32) / 1.8000 FROM weather WHERE SUBSTR(CAST(date AS TEXT), 1, INSTR(date, '/') - 1) = '8' AND SUBSTR(CAST(date AS TEXT), -4) = '2013' AND zip_code = 94107 |
Write SQL query to solve given problem: What is the ratio for subscriber to customer given that the starting and the ending stations is 2nd at South Park?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(IIF(subscription_type = 'Subscriber', 1, 0)) AS REAL) / SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_station_name = '2nd at South Park' AND end_station_name = '2nd at South Park' |
Write SQL query to solve given problem: Are all stations with zip code 94107 located in San Francisco city?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.zip_code = 94107 |
Write SQL query to solve given problem: List out all stations name that having a mean temperature 20 degree Celsius in year 2014.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT DISTINCT T2.start_station_name, T2.end_station_name FROM weather AS T1 INNER JOIN trip AS T2 ON T1.zip_code = T2.zip_code WHERE T1.date LIKE '%2014' AND T1.mean_temperature_f = 20 * 1.8 + 32 |
Write SQL query to solve given problem: How many bicycle trip were made within San Jose city during August 2013?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.city = 'San Jose' AND T2.start_date LIKE '8/%/2013%' AND T2.start_station_name LIKE 'San Jose%' AND T2.end_station_name LIKE 'San Jose%' |
Write SQL query to solve given problem: Is there any intercity trip were made during 2014? If yes, list out the city name for the start and end station.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.start_station_name, T1.end_station_name FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_date LIKE '%/%/2014%' AND T1.start_station_name != T1.end_station_name |
Write SQL query to solve given problem: Does the bike with Id number 16 making any intercity trip? If yes, calculate the total travel duration during all the intercity trip. Convert the duration to hour.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.end_station_name, T2.city, CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.bike_id = 16 AND T1.start_station_name != T1.end_station_name |
Write SQL query to solve given problem: What is the ratio of customer to subscriber that making a trip inside Mountain View city?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Mountain View' |
Write SQL query to solve given problem: What is the total trip duration made within Palo Alto city? Convert the duration to hour.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto' |
Write SQL query to solve given problem: Which bicycle is the least used bike. Check if the start and end station are from the same city and calculate the total duration travelled by the bicycle in hours for a trip made within the same city.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.bike_id, T2.start_station_name, T2.end_station_name, T1.city , CAST(T2.duration AS REAL) / 3600 FROM station AS T1 INNER JOIN trip AS T2 ON T1.name = T2.start_station_name GROUP BY T2.bike_id ORDER BY COUNT(T2.id) DESC LIMIT 1 |
Write SQL query to solve given problem: Count the number of subscribers who started their trips in Market at 4th.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip |
Write SQL query to solve given problem: List the names of the stations within Mountain View that were installed on 12/31/2013.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT name FROM station WHERE installation_date = '12/31/2013' AND city = 'Mountain View' |
Write SQL query to solve given problem: Which city is Townsend at 7th Station located and how many bikes could it hold?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT city, SUM(dock_count) FROM station WHERE name = 'Townsend at 7th' |
Write SQL query to solve given problem: How many bikes could Evelyn Park and Ride hold and how many users who started on that station are subscribers?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(T2.dock_count), COUNT(T1.subscription_type) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.name = 'Evelyn Park and Ride' AND T1.start_station_name = T2.name AND T1.subscription_type = 'Subscriber' |
Write SQL query to solve given problem: How many subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T3.zip_code), T3.max_temperature_f FROM trip AS T2 INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 AND T2.subscription_type = 'Subscriber' ORDER BY T3.max_temperature_f DESC LIMIT 1 |
Write SQL query to solve given problem: What is the percentage ration of customers to subscribers that started their trips within the city of San Francisco?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco' |
Write SQL query to solve given problem: What is the average duration of trips for the starting station of Santa Clara at Almaden and what is the latitude and longitude of this station?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration), T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name LEFT JOIN station AS T3 ON T3.name = T1.end_station_name WHERE T1.start_station_name = 'Santa Clara at Almaden' |
Write SQL query to solve given problem: What is the shortest trip made starting from Franklin at Maple and what is the maximum wind speed at that date?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT MIN(T1.duration), MAX(T2.max_wind_Speed_mph) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_station_name = 'Franklin at Maple' AND T2.date = '9/4/2013' |
Write SQL query to solve given problem: How many bikes have been borrowed at San Jose Diridon Caltrain Station on the date and time of 10/20/2013 8:11:01 AM and indicate the station's coordinates.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT SUM(T2.bikes_available), T1.long, T1.lat FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/10/20 8:11:01' AND T1.name = 'San Jose Diridon Caltrain Station' |
Write SQL query to solve given problem: Name the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T2.city, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842 |
Write SQL query to solve given problem: How many stations were installed on the date of 8/16/2013 and how many users on those stations are classified as a customer?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.name) , SUM(CASE WHEN T2.subscription_type = 'Customer' THEN 1 ELSE 0 END) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.installation_date = '8/16/2013' AND T2.subscription_type = 'Customer' |
Write SQL query to solve given problem: Which station did the user who started at Market at 4th station ended their trip at the time of 12:45:00 PM and the date of 8/29/2013 and what is the location coordinates of the ending station?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T2.start_station_name = 'Market at 4th' AND T2.end_date = '8/29/2013 12:45' |
Write SQL query to solve given problem: How many subscribers have ended their trip at MLK Library and how many docks does that station have?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT COUNT(T1.id), T2.dock_count FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.end_station_name = 'MLK Library' AND T1.subscription_type = 'Subscriber' AND T2.dock_count = 19 |
Write SQL query to solve given problem: What is the average coldest temperature for the zip code of 94301 and what stations are within the zip code? Include the latitude and longitude as well.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T3.min_temperature_f), T1.long, T1.lat FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 |
Write SQL query to solve given problem: Calculate the average duration travelled by subscribers that both started and ended their trip in Mountain View City Hall and indicate the date when the station was first installed.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | bike_share_1 | SELECT AVG(T1.duration), T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = 'Mountain View City Hall' AND T1.subscription_type = 'Subscriber' AND T1.end_station_name = 'Mountain View City Hall' |
Write SQL query to solve given problem: What is the description of the film ACADEMY DINOSAUR?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR' |
Write SQL query to solve given problem: How many films have a rental duration of over 6 days?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT COUNT(film_id) FROM film WHERE rental_duration > 6 |
Write SQL query to solve given problem: Please list the titles of the films that are released in 2006 and have a rental rate of $2.99.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT title FROM film WHERE release_year = 2006 AND rental_rate = 2.99 |
Write SQL query to solve given problem: Which film has the longest duration of film screening? Please give its title.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT title FROM film ORDER BY length DESC LIMIT 1 |
Write SQL query to solve given problem: Which film has a higher replacement cost, ACE GOLDFINGER or ACADEMY DINOSAUR?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT title FROM film WHERE title IN ('ACE GOLDFINGER', 'ACADEMY DINOSAUR') ORDER BY replacement_cost DESC LIMIT 1 |
Write SQL query to solve given problem: Among the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006 |
Write SQL query to solve given problem: How many films with the rental rate of $2.99 have the special feature of "Deleted Scenes"?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT COUNT(film_id) FROM film WHERE rental_rate = 2.99 AND special_features = 'Deleted Scenes' |
Write SQL query to solve given problem: Please list the titles of all the films that have more than 2 special features.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT title FROM ( SELECT title, COUNT(special_features) AS num FROM film GROUP BY title ) AS T ORDER BY T.num > 2 |
Write SQL query to solve given problem: What is the email address of the staff Jon Stephens?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens' |
Write SQL query to solve given problem: Please give the full names of all the active staff.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT first_name, last_name FROM staff WHERE active = 1 |
Write SQL query to solve given problem: In which year was the film with the highest replacement cost released?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT DISTINCT release_year FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film ) |
Write SQL query to solve given problem: Please list the titles of the top 3 films with the highest replacement cost.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT title FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film ) LIMIT 3 |
Write SQL query to solve given problem: What is the language of the film ACADEMY DINOSAUR?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT T2.name FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'ACADEMY DINOSAUR' |
Write SQL query to solve given problem: How many films are in English?. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' |
Write SQL query to solve given problem: Please list the titles of all the films starring the actor PENELOPE GUINESS.. Keep the solution inside sql tag ```sql [SQL-Query] ``` | movie_3 | SELECT T2.title FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = 'PENELOPE' AND T3.last_name = 'GUINESS' |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.