Chinastark/bird_dataset huggingface dataset:
Database: human_resources
Note: poor performance refers to performance = 'Poor'; full name = firstname, lastname; managers is a position title;
Question: Among the employees with poor performance, provide the managers' full names, location city, address and its zip code.
SQL: SELECT employee.firstname, employee.lastname, LOCATION.locationcity, LOCATION.address, LOCATION.zipcode FROM employee  INNER JOIN LOCATION  ON employee.locationid = LOCATION.locationid INNER JOIN POSITION  ON POSITION.positionid = employee.positionid WHERE POSITION.positiontitle = 'Manager' AND employee.performance = 'Poor'
Database: human_resources
Note: account representative is a position title; full name = firstname, lastname; poor performance refers to performance = 'Poor';
Question: What is the education required to be account representative? Mention account representative full name and salary who got poor in performance status.
SQL: SELECT POSITION.educationrequired, employee.firstname, employee.lastname, employee.salary FROM employee  INNER JOIN POSITION  ON employee.positionid = POSITION.positionid WHERE employee.performance = 'Poor' AND POSITION.positiontitle = 'Account Representative'
Database: human_resources
Note: full name = firstname, lastname; ssn = '767-74-7373';
Question: Write down the full name, performance status and located city of the employee who's social security number is "767-74-7373".
SQL: SELECT employee.firstname, employee.lastname, LOCATION.state, LOCATION.locationcity FROM employee  INNER JOIN LOCATION  ON employee.locationid = LOCATION.locationid WHERE employee.ssn = '767-74-7373'
Database: human_resources
Note: full name = firstname, lastname; Colorado state refers to state = 'CO'; positions refers to positiontitle; located city refers to locationcity; office phone number refers to officephone;
Question: Describe the employees' full name, positions, located city and office phone number within Colorado state.
SQL: SELECT employee.firstname, employee.lastname, POSITION.positiontitle, LOCATION.locationcity, LOCATION.officephone FROM employee  INNER JOIN LOCATION  ON employee.locationid = LOCATION.locationid INNER JOIN POSITION  ON POSITION.positionid = employee.positionid WHERE LOCATION.state = 'CO'
Database: human_resources
Note: highest salary refers to MAX(salary); name = firstname, lastname; calculation = DIVIDE(MAX(salary), 12);
Question: Calculate the monthly average salary of the employee with highest salary. Mention his name, position title and location city.
SQL: SELECT sum(cast(replace(substr(employee.salary, 4), ',', '') AS REAL)) / 12 AS AVG, employee.firstname, employee.lastname , POSITION.positiontitle, LOCATION.locationcity FROM employee  INNER JOIN POSITION  ON employee.positionid = POSITION.positionid INNER JOIN LOCATION  ON employee.locationid = LOCATION.locationid WHERE cast(replace(substr(employee.salary, 4), ',', '') AS REAL) = ( SELECT max(cast(replace(substr(employee.salary, 4), ',', '') AS REAL)) FROM employee  INNER JOIN POSITION  ON employee.positionid = POSITION.positionid INNER JOIN LOCATION  ON employee.locationid = LOCATION.locationid )
Database: bike_share_1
Note: start station refers to start_station_name; end station refers to end_station_name;
Question: Which trip had the longest duration? State the start and end station.
SQL: SELECT start_station_name, end_station_name FROM trip WHERE duration = ( SELECT max(duration) FROM trip )
Database: bike_share_1
Note: subscription_type = 'Subscriber'; DIVidE(COUNT(id where subscription_type = 'Subscriber'), COUNT(id)) as percentage;
Question: What is the percentage of the trip were done by a subscriber?
SQL: SELECT cast(count(subscription_type) AS REAL) * 100 / ( SELECT count(subscription_type) FROM trip ) FROM trip WHERE subscription_type = 'Subscriber'
Database: bike_share_1
Note: final station refers to end_station_name where MAX(end_date);
Question: State the final station of bike id 13. Which city was it at?
SQL: SELECT trip.end_station_id, station.city FROM station INNER JOIN trip ON station.name = trip.end_station_name WHERE trip.bike_id = 13 ORDER BY trip.end_date DESC LIMIT 1
Database: bike_share_1
Note: the bike was borrowed and returned on a different day implies that start_date and end_date are not equal to each other; where the bike was returned refers to end_station_name;
Question: Name all the trips where the bike was borrowed and returned on a different day. State the city where the bike was returned.
SQL: SELECT DISTINCT station.city FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE substr(cast(trip.start_date AS TEXT), instr(trip.start_date, '/') + 1) - substr(cast(trip.start_date AS TEXT), instr(trip.start_date, ' ') - 5) <> substr(cast(trip.end_date AS TEXT), instr(trip.end_date, '/') + 1) - substr(cast(trip.end_date AS TEXT), instr(trip.end_date, ' ') - 5)
Database: bike_share_1
Note: latitude and longitude coordinates can be used to indicate a location, where latitude refers to lat longtitude refer to long; bikes_available = 0 means no bike can be borrowed; 3/11/2013 02:01:01 refers to time;
Question: Which is the station where no bike could not be borrowed form on the 2013/11/03 02:01:01? State the location of the station.
SQL: SELECT station.name, station.long FROM station INNER JOIN status ON status.station_id = station.id WHERE status.time = '2013/11/03 02:01:01' AND status.bikes_available = 0
Database: bike_share_1
Note: the station with the most borrowed bikes refers to MAX(start_station);
Question: Name the station and city with the most borrowed bike.
SQL: SELECT trip.start_station_name, station.city FROM station INNER JOIN trip ON trip.start_station_name = station.name GROUP BY trip.start_station_name ORDER BY count(trip.start_station_name) DESC LIMIT 1
Database: bike_share_1
Note: the hottest temperature refers to max_temperature_f;
Question: What was the hottest temperature on the day of trip ID 4080?
SQL: SELECT max(weather.max_temperature_f) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code AND weather.date = substr(cast(trip.start_date AS TEXT), 1, instr(trip.start_date, ' ') - 1) WHERE trip.id = 4080
Database: bike_share_1
Note: San Jose Diridon Caltrain station is the name of the station; most bikes available refers to MAX(bikes_available);
Question: At what date and time did San Jose Diridon Caltrain Station have most bikes available.
SQL: SELECT status.time FROM station INNER JOIN status ON status.station_id = station.id WHERE station.name = 'San Jose Diridon Caltrain Station' AND status.bikes_available = ( SELECT max(status.bikes_available) FROM station INNER JOIN status ON status.station_id = station.id WHERE station.name = 'San Jose Diridon Caltrain Station' )
Database: bike_share_1
Note: events = 'Rain';
Question: Name all the trip on the days when it rained. State the duration of the trip
SQL: SELECT trip.id, trip.duration FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code AND weather.date = substr(cast(trip.start_date AS TEXT), 1, instr(trip.start_date, ' ') - 1) WHERE weather.events LIKE '%Rain%' OR weather.events LIKE '%rain%'
Database: bike_share_1
Note: 37.331415 and -121.8932 are latitude (lat) and longitude (long) coordinates indicating location; returned at refers to end_station_name; the date the bike was borrowed refers to start_date;
Question: List all trips where bikes were returned at location 37.331415, -121.8932. State the date the bike was borrowed.
SQL: SELECT trip.end_station_name, trip.start_date FROM station INNER JOIN trip ON trip.end_station_name = station.name WHERE station.lat = 37.331415 AND station.long = -121.8932
Database: bike_share_1
Note: Redwood city is the name of the city; trips in August 2013 refers to start_date like '8%2013%';
Question: Among the trips in August 2013, how many bikes were borrowed from Redwood City.
SQL: SELECT count(trip.start_date) FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE trip.start_date LIKE '8/%/2013%' AND station.city = 'Redwood City'
Database: bike_share_1
Note: less than 5 minutes refers to duration<300 in seconds; the station where the bike was borrowed refers to start_station_name; the station where the bike was returned refers to end_station_name; mean temperature refers to min_temperature_f;
Question: For all trips which took less 5 minutes, state the station name where the bike were borrowed and returned. Indicate mean temperature of the day.
SQL: SELECT trip.start_station_name, trip.end_station_name, weather.mean_temperature_f FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.duration < 300
Database: bike_share_1
Note: which day had the most bikes borrowed refers to MAX(start_date); the average coldest temperature can be computed as DIVidE(SUM(min_temperature_f), COUNT(min_temperature_f));
Question: Among all the trips, which day had the most bikes borrowed? What was the average coldest temperature on that day?
SQL: SELECT weather.date, avg(weather.min_temperature_f) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code GROUP BY weather.date ORDER BY count(trip.start_date) DESC LIMIT 1
Database: bike_share_1
Note: the third quarter of year 2013 implies 3 month interval, including July, August, and September of 2013 and refers to date; the average usage of each bike = DIVidE(SUM(duration), COUNT(bike_id)); the average wind direction = DIVidE(SUM(wind_dir_degrees), COUNT(date));
Question: Calculate the average usage of each bike in the third quarter of year 2013. Find the average wind direction within the same period.
SQL: SELECT avg(trip.duration), avg(weather.wind_dir_degrees) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE substr(cast(weather.date AS TEXT), 1, instr(weather.date, '/') - 1) IN ('7', '8', '9') AND substr(cast(weather.date AS TEXT), -4) = '2013'
Database: bike_share_1
Note: San Jose is the name of the city; 2014 refers to installation_date between '1/1/2014' and '12/31/2014';
Question: How many bike stations were installed in San Jose in 2014? Indicate the names of the stations.
SQL: SELECT sum(CASE WHEN city = 'San Jose' AND substr(installation_date, -4) = '2014' THEN 1 ELSE 0 END) FROM station UNION SELECT name FROM station WHERE city = 'San Jose' AND substr(installation_date, -4) = '2014'
Database: bike_share_1
Note: started and ended August 29, 2013 refers to start_date = '8/29/2013' and end_date = '8/29/2013';
Question: What is the longest trip duration that started and ended August 29, 2013?
SQL: SELECT max(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
Database: bike_share_1
Note: duration in minutes refers to DIVidE(duration, 60 seconds); 2nd at South Park refers to end_station_name; Market at 4th refers to start_station_name; start_date = '8/29/2013'; end_date = '8/29/2013';
Question: How long did it take for bike id 426 to reach 2nd at South Park from Market at 4th on 8/29/2013? Indicate the duration in minutes.
SQL: SELECT cast(duration AS REAL) / 60  FROM trip WHERE bike_id = 426 AND end_station_name = '2nd at South Park' AND start_station_name = 'Market at 4th' AND start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%'
Database: bike_share_1
Note: start_date = '8/29/2013'; end_date = '8/29/2013'; end_station_name = 'California Ave Caltrain station'; start_station_name = 'University and Emerson'; who took the longest to arrive refers to MAX(duration);
Question: On 8/29/2013, who took the longest to arrive in California Ave Caltrain Station from University and Emerson? Indicate the bike id.
SQL: SELECT bike_id FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' AND duration = ( SELECT max(duration) FROM trip WHERE start_date LIKE '8/29/2013%' AND end_date LIKE '8/29/2013%' AND end_station_name = 'California Ave Caltrain Station' AND start_station_name = 'University and Emerson' )
Database: bike_share_1
Note: San Francico is the name of the city; can hold more than 20 bikes implies dock's capacity and refers to dock_count≥20;
Question: How many stations in San Francico can hold more than 20 bikes?
SQL: SELECT sum(CASE WHEN city = 'San Francisco' AND dock_count > 20 THEN 1 ELSE 0 END) FROM station
Database: bike_share_1
Note: the hottest temperature refers to max_temperature_f;
Question: When was the hottest temperature recorded? If there are multiple dates with the hottest temperature, indicate all of the dates.
SQL: SELECT max_temperature_f, date FROM weather WHERE max_temperature_f = ( SELECT max(max_temperature_f) FROM weather WHERE max_temperature_f IS NOT NULL AND max_temperature_f IS NOT '' )
Database: bike_share_1
Note: the maximum dew point in Fahrenheit degree refers to max_dew_point_f; date = '7/15/2014';
Question: What is the maximum dew point in Fahrenheit degree on 7/15/2014 in the area with a zip code of 94301?
SQL: SELECT DISTINCT CASE WHEN date = '7/15/2014' AND zip_code = 94301 THEN max_dew_point_f END FROM weather
Database: bike_share_1
Note: events = 'Rain'; year refers to YEAR(date);
Question: Which year experienced the most rain?
SQL: SELECT substr(cast(date AS TEXT), -4) FROM weather GROUP BY substr(cast(date AS TEXT), -4) ORDER BY sum(CASE WHEN EVENTS LIKE '%Rain%' OR EVENTS LIKE '%rain%' THEN 1 ELSE 0 END) DESC LIMIT 1
Database: bike_share_1
Note: lat = '37.789625' and long = '-122.400811' are latitude and longitude coordinates indicating location; started from the station refers to start_station_name; start_date = '10/20/2014'; duration of the fastest trip refers to MIN(duration);
Question: On 10/20/2014, what is the duration of the fastest trip which started from the station with latitude and longitudes of 37.789625 and -122.400811, respectively? Indicate the bike id.
SQL: SELECT min(trip.duration), trip.bike_id FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE trip.start_date LIKE '10/20/2014%' AND station.lat = 37.789625 AND station.long = -122.400811
Database: bike_share_1
Note: South Van Ness at Market refers to start_station_name; subscriber refers to subscription_type; start_date = '12/1/2013'; the shortest duration refers to MIN(duration); which station was the bike returned to refers to end_station_name;
Question: Among the subscribers who rented a bike from South Van Ness at Market on 12/1/2013, whose duration was the shortest and to which station was the bike returned to? Indicate South Van Ness's dock count.
SQL: SELECT min(trip.duration), trip.end_station_name, count(trip.start_station_name) FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE trip.start_date LIKE '12/1/2013%' AND trip.start_station_name = 'South Van Ness at Market' AND trip.subscription_type = 'Subscriber'
Database: bike_share_1
Note: Powell Street refers to start_station_name; bike 496 refers to bike_id = '496'; start_date = '8/29/2013';
Question: What is the maximum humidity in Powell Street BART when bike 496 was borrowed from the station on 8/29/2013?
SQL: SELECT weather.max_humidity FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.start_date LIKE '8/29/2013%' AND trip.bike_id = 496 AND trip.start_station_name = 'Powell Street BART'
Database: bike_share_1
Note: day in the month of November, 2014 refers to start_date between '11/1/2014' and '11/30/2014'; foggy weather refers to events = 'Fog'; subscriber refers to subscription_type; all of the stations bikes were borrowed from refer to start_station_name;
Question: Which day in the month of November, 2014 have a foggy weather in the zip code 94301 and in total, how many bikes were borrowed by subscribers from all of the stations in the said day?
SQL: SELECT weather.date, count(trip.start_station_name) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE weather.date LIKE '11/%/2014%' AND weather.zip_code = 94301 AND weather.events = 'Fog' AND trip.subscription_type = 'Subscriber'
Database: bike_share_1
Note: less used station where bikes are borrowed from refers to start_station_name which has the least number of customers; subscription_type = 'Customer'; when installed refers to installation_date;
Question: What is the name of the station that is less used by customers who borrow bikes from? Indicate when was the station installed.
SQL: SELECT trip.start_station_name, station.installation_date FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE trip.subscription_type = 'Customer' GROUP BY trip.start_station_name ORDER BY count(trip.subscription_type) LIMIT 1
Database: bike_share_1
Note: time = '11/3/2013'; which stations are empty refers to bikes_available = '0';
Question: On 11/3/2013, which stations are often empty? Indicate the names of the stations.
SQL: SELECT DISTINCT station.name FROM station INNER JOIN status ON status.station_id = station.id WHERE status.bikes_available = 0 AND status.time LIKE '2013/11/03%'
Database: bike_share_1
Note: DIVidE(SUM(duration where city = 'Palo Alto'), COUNT(start_station_id));
Question: What is the average duration of bike trips in the city of Palo Alto?
SQL: SELECT avg(trip.duration) FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE station.city = 'Palo Alto'
Database: bike_share_1
Note: route implies a course taken in getting from start_station_name to end_station_name; the longest duration refers to MAX(duration);
Question: What is the route that has the longest duration? Indicate the city of where the stations are located.
SQL: SELECT trip.start_station_name, trip.end_station_name, station.city FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE trip.duration = ( SELECT max(trip.duration) FROM trip LEFT JOIN station ON station.name = trip.start_station_name )
Database: bike_share_1
Note: from 8/5/2013 to 12/31/2013 refers to installation_date between '8/5/2013' and '12/31/2013';
Question: List the name of stations that were installed from 8/5/2013 to 12/31/2013. Indicate their installation date and city name.
SQL: 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')
Database: bike_share_1
Note: trips refer to id; DIVidE(SUM(duration where start_station_name = 'Adobe on Almaden', end_station_name = 'Ryland Park'), COUNT(id));
Question: What is the average duration of trips which are started at Adobe on Almaden station to Ryland Park?
SQL: SELECT avg(duration) FROM trip WHERE start_station_name = 'Adobe on Almaden' AND end_station_name = 'Ryland Park'
Database: bike_share_1
Note: no available bike to borrow refers to bikes_available = 0; latitude and longitude coordinates can be used to indicate a location;
Question: Write down the times when there is no available bike to borrow in a station. List down the stations name and location coordinate.
SQL: SELECT status.time, station.name, station.lat, station.long FROM station INNER JOIN status ON status.station_id = station.id WHERE status.bikes_available = 0
Database: bike_share_1
Note: start and end station are similar refers to start_station_name = end_station_name; latitude and longitude coordinates can be used to indicate a location;
Question: List down the trips in which their start and end station are similar. Give me their trip IDs and location coordinates.
SQL: SELECT trip.id, station.lat, station.long FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE trip.start_station_name = trip.end_station_name
Database: bike_share_1
Note: How many bikes borrowed can be computed as SUBTRACT(SUM(dock_count), bikes_available where name = 'San Jose Diridon Caltrain station' and time = '2013/08/29 06:14:01');
Question: On 8/29/2013 at 6:14:01 PM, how many bikes were borrowed from San Jose Diridon Caltrain Station?
SQL: SELECT sum(station.dock_count - status.bikes_available) FROM station INNER JOIN status ON station.id = status.station_id WHERE station.name = 'San Jose Diridon Caltrain Station' AND status.time = '2013/08/29 06:14:01'
Database: bike_share_1
Note: bike no. 10 refers to bike_id = '10'; subscription_type = 'Subscriber'; the weather's mean temperature is no less than 62 degress Fahrenheit refers to mean_temperature_f>62;
Question: 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.
SQL: SELECT trip.id FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.bike_id = 10 AND weather.mean_temperature_f > 62 AND trip.subscription_type = 'Subscriber'
Database: bike_share_1
Note: subscription_type = 'Customer'; duration = '364'; bike no. 10 refers to bike_id = 10; start_station_name = 'San Jose Civic Center'; end_station_name = 'San Jose city Hall';
Question: 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?
SQL: SELECT weather.max_gust_speed_mph, weather.cloud_cover FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code AND weather.date = substr(cast(trip.start_date AS TEXT), 1, instr(trip.start_date, ' ') - 1) WHERE trip.bike_id = 10 AND weather.mean_temperature_f > 62 AND trip.subscription_type = 'Customer' AND trip.start_station_name = 'MLK Library' AND trip.end_station_name = 'San Salvador at 1st' AND trip.duration = 386
Database: bike_share_1
Note: subscription_type = 'Subscriber'; no more than 490 seconds refers to duration<490; start_station_name = '2nd at Folsom'; end_station_name = 'Civic Center BART (7th at Market)'; min_visibility_miles = 4;
Question: 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.
SQL: SELECT count(trip.id) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.subscription_type = 'Subscriber' AND weather.min_visibility_miles = 4 AND trip.duration < 490 AND trip.start_station_name = '2nd at Folsom' AND trip.end_station_name = 'Civic Center BART (7th at Market)'
Database: bike_share_1
Question: How many docks were available at the starting station of trip ID 912900?
SQL: SELECT sum(status.docks_available) FROM trip INNER JOIN status ON status.station_id = trip.start_station_id WHERE trip.zip_code = 912900
Database: bike_share_1
Note: the minimum temperature is less than 45 degrees Fahrenheit refers to min_temperature_f<45;
Question: Please write down the trip IDs which ended on the days when the minimum temperature is less than 45 degrees Fahrenheit.
SQL: SELECT trip.id FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE weather.min_temperature_f < 45
Database: bike_share_1
Note: the shortest duration refers to MIN(duration); subscription_type = 'Subscriber', start_station_name = '2nd at Folsom', end_station_name = '5th at Howard'; in 2014 refers to time period between start_date = '1/1/2014 0:00' and end_date = '12/31/2014 11:59; Average duration = DIVidE(SUM(duration), COUNT(id));
Question: 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.
SQL: SELECT min(trip.duration) , min(trip.duration) - avg(trip.duration), weather.min_temperature_f FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.start_date = '1/1/2014 0:00' AND trip.end_date = '12/31/2014 11:59' AND trip.start_station_name = '2nd at Folsom' AND trip.end_station_name = '5th at Howard' AND trip.subscription_type = 'Subscriber'