Chinastark/bird_dataset huggingface dataset:
Database: bike_share_1
Note: during August 2013 refers to start_date like '8/%/2013%';
Question: How many bicycle trip were made within San Jose city during August 2013?
SQL: SELECT count(trip.id) FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE station.city = 'San Jose' AND trip.start_date LIKE '8/%/2013%' AND trip.start_station_name LIKE 'San Jose%' AND trip.end_station_name LIKE 'San Jose%'
Database: bike_share_1
Note: intercity trip refers to start_station_name! = end_station_name; during 2014 refers to start_date like '%2014%'; start station refers to start_station_name; end station refers to end_station_name;
Question: Is there any intercity trip were made during 2014? If yes, list out the city name for the start and end station.
SQL: SELECT trip.start_station_name, trip.end_station_name FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE trip.start_date LIKE '%/%/2014%' AND trip.start_station_name != trip.end_station_name
Database: bike_share_1
Note: intercity trip refers to start_station_name! = end_station_name; total travel duration to hour = DIVidE(SUM(duration), 3600) AS hour;
Question: 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.
SQL: SELECT trip.end_station_name, station.city, cast(sum(trip.duration) AS REAL) / 3600 FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE trip.bike_id = 16 AND trip.start_station_name != trip.end_station_name
Database: bike_share_1
Note: customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; ratio = MULTIPLY(DIVidE(COUNT(subscription_type = 'Customer'), COUNT(subscription_type = 'Subscriber'). 1.0)) AS ratio;
Question: What is the ratio of customer to subscriber that making a trip inside Mountain View city?
SQL: SELECT cast(sum(CASE WHEN trip.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(CASE WHEN trip.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE station.city = 'Mountain View'
Database: bike_share_1
Note: total trip duration to hour = DIVidE(SUM(duration), 3600);
Question: What is the total trip duration made within Palo Alto city? Convert the duration to hour.
SQL: SELECT cast(sum(trip.duration) AS REAL) / 3600 FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE station.city = 'Palo Alto'
Database: bike_share_1
Note: least used bike refers to bike_id with MIN(COUNT(main_trip.id)); start station refers to start_station_name; end station refers to end_station_name; total duration in hour = DIVidE(duration, 3600) AS hour;
Question: 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.
SQL: SELECT trip.bike_id, trip.start_station_name, trip.end_station_name, station.city , cast(trip.duration AS REAL) / 3600 FROM station INNER JOIN trip ON station.name = trip.start_station_name GROUP BY trip.bike_id ORDER BY count(trip.id) DESC LIMIT 1
Database: bike_share_1
Note: subsscriber refers to subscription_type = subscriber; started their trips in refers to start_station_name; start_station_name = 'Market at 4th';
Question: Count the number of subscribers who started their trips in Market at 4th.
SQL: SELECT count(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip
Database: bike_share_1
Note: Mountain View refers to city = 'Mountain View'; installed on 12/31/2013 refers to installation_date = '12/31/2013';
Question: List the names of the stations within Mountain View that were installed on 12/31/2013.
SQL: SELECT name FROM station WHERE installation_date = '12/31/2013' AND city = 'Mountain View'
Database: bike_share_1
Note: Townsend at 7th station refers to city = 'Townsend at 7th station'; number of bikes a station can hold refers to SUM(dock_count);
Question: Which city is Townsend at 7th Station located and how many bikes could it hold?
SQL: SELECT city, sum(dock_count) FROM station WHERE name = 'Townsend at 7th'
Database: bike_share_1
Note: number of bikes a station can hold refers to SUM(dock_count); Evelyn Park and Ride refers to name = 'Evelyn Park and Ride'; started on the station refers to start_station_name; subscribers refers to subscription_type = 'subscriber';
Question: How many bikes could Evelyn Park and Ride hold and how many users who started on that station are subscribers?
SQL: SELECT sum(station.dock_count), count(trip.subscription_type) FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE station.name = 'Evelyn Park and Ride' AND trip.start_station_name = station.name AND trip.subscription_type = 'Subscriber'
Database: bike_share_1
Note: hottest temperature refers to MAX(max_temperature_f);
Question: How many subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code?
SQL: SELECT count(weather.zip_code), weather.max_temperature_f FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE weather.zip_code = 94301 AND trip.subscription_type = 'Subscriber' ORDER BY weather.max_temperature_f DESC LIMIT 1
Database: bike_share_1
Note: customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; started their trips within refers to start_station_id; percentage ratio = DIVidE(SUM(subscription_type = 'Customer'), SUM(subscription_type = 'Subscriber')) as percentage;
Question: What is the percentage ration of customers to subscribers that started their trips within the city of San Francisco?
SQL: SELECT cast(sum(CASE WHEN trip.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(CASE WHEN trip.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip LEFT JOIN station ON station.name = trip.start_station_name WHERE station.city = 'San Francisco'
Database: bike_share_1
Note: average duration = DIVidE(SUM(duration), COUNT(id)); starting station refers to start_station_name; start_station_name = 'Santa Clara at Almaden'; latitude refers to lat; longitude refers to long;
Question: 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?
SQL: SELECT avg(trip.duration), station.lat, station.long FROM trip LEFT JOIN station ON station.name = trip.start_station_name LEFT JOIN station ON station.name = trip.end_station_name WHERE trip.start_station_name = 'Santa Clara at Almaden'
Database: bike_share_1
Note: shortest trip refers to MIN(duration); starting from refers to start_station_name; start_station_name = 'Franklin at Maple'; maximum wind speed refers to max_wind_speed_mph;
Question: What is the shortest trip made starting from Franklin at Maple and what is the maximum wind speed at that date?
SQL: SELECT min(trip.duration), max(weather.max_wind_speed_mph) FROM trip INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE trip.start_station_name = 'Franklin at Maple' AND weather.date = '9/4/2013'
Database: bike_share_1
Note: number of bikes that have been borrowed refers to SUM(bikes_available); San Jose Diridon Caltrain station refers to name = 'San Jose Diridon Caltrain station'; station's coordinates refers to (lat, long);
Question: 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.
SQL: SELECT sum(status.bikes_available), station.long, station.lat FROM station INNER JOIN status ON status.station_id = station.id WHERE status.time = '2013/10/20 8:11:01' AND station.name = 'San Jose Diridon Caltrain Station'
Database: bike_share_1
Note: when the station was first installed refers to installation_date;
Question: Name the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.
SQL: SELECT station.city, station.installation_date FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE trip.id = 585842
Database: bike_share_1
Note: installed on refers to installation_date; installation_date = '8/16/2013'; customers refers to subscription_type = customers;
Question: How many stations were installed on the date of 8/16/2013 and how many users on those stations are classified as a customer?
SQL: SELECT count(station.name) , sum(CASE WHEN trip.subscription_type = 'Customer' THEN 1 ELSE 0 END) FROM station INNER JOIN trip ON trip.start_station_name = station.name WHERE station.installation_date = '8/16/2013' AND trip.subscription_type = 'Customer'
Database: bike_share_1
Note: started at refers to start_station_name; start_station_name = 'Market at 4th'; location coordinates refers to (lat, long);
Question: 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?
SQL: SELECT station.name, station.lat, station.long FROM station INNER JOIN trip ON trip.end_station_name = station.name WHERE trip.start_station_name = 'Market at 4th' AND trip.end_date = '8/29/2013 12:45'
Database: bike_share_1
Note: subscribers refers to subscription_type = 'subscribers'; ended their trip at refers to end_station_name; end_station_name = 'MLK Library'; number of docks a station have refers to dock_count;
Question: How many subscribers have ended their trip at MLK Library and how many docks does that station have?
SQL: SELECT count(trip.id), station.dock_count FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE trip.end_station_name = 'MLK Library' AND trip.subscription_type = 'Subscriber' AND station.dock_count = 19
Database: bike_share_1
Note: coldest temperature refers to min_temperature_f; average coldest temperature refers = AVG(min_temperature_f); stations refers to name; latitude refers to lat; longitude refers to long;
Question: 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.
SQL: SELECT avg(weather.min_temperature_f), station.long, station.lat FROM station INNER JOIN trip ON trip.start_station_name = station.name INNER JOIN weather ON weather.zip_code = trip.zip_code WHERE weather.zip_code = 94301
Database: bike_share_1
Note: average duration = DIVidE(SUM(duration), COUNT(id)); subscribers refers to subscription_type = 'subscriptions'; started and ended their trip at Mountain View city Hall refers to start_station_name = 'Mountain View city Hall' and end_station_name = 'Mountain View city Hall'; when the station was first installed refers to installation_date;
Question: 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.
SQL: SELECT avg(trip.duration), station.installation_date FROM trip INNER JOIN station ON station.name = trip.start_station_name WHERE trip.start_station_name = 'Mountain View City Hall' AND trip.subscription_type = 'Subscriber' AND trip.end_station_name = 'Mountain View City Hall'
Database: movie_3
Note: "ACADEMY DINOSAUR" is the title of film;
Question: What is the description of the film ACADEMY DINOSAUR?
SQL: SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'
Database: movie_3
Note: rental duration of over 6 days refers to rental_duration > 6;
Question: How many films have a rental duration of over 6 days?
SQL: SELECT count(film_id) FROM film WHERE rental_duration > 6
Database: movie_3
Note: released in 2006 refers to release_year = 2006; rental rate of $2.99 refers to rental_rate = 2.99;
Question: Please list the titles of the films that are released in 2006 and have a rental rate of $2.99.
SQL: SELECT title FROM film WHERE release_year = 2006 AND rental_rate = 2.99
Database: movie_3
Note: longest duration of film refers to Max(length);
Question: Which film has the longest duration of film screening? Please give its title.
SQL: SELECT title FROM film ORDER BY LENGTH DESC LIMIT 1
Database: movie_3
Note: higher replacement cost refers to Max(replacement_cost); 'ACE GOLDFIINGER' and 'ACADEMY DINOSAUR' are both the title of film;
Question: Which film has a higher replacement cost, ACE GOLDFINGER or ACADEMY DINOSAUR?
SQL: SELECT title FROM film WHERE title IN ('ACE GOLDFINGER', 'ACADEMY DINOSAUR') ORDER BY replacement_cost DESC LIMIT 1
Database: movie_3
Note: released in 2006 refers to release_year = 2006; rated Adults Only refers to rating = 'NC-17';
Question: Among the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating?
SQL: SELECT count(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006
Database: movie_3
Note: rental rate of $2.99 refers to rental_rate = 2.99; film refers to title;
Question: How many films with the rental rate of $2.99 have the special feature of "Deleted Scenes"?
SQL: SELECT count(film_id) FROM film WHERE rental_rate = 2.99 AND special_features = 'Deleted Scenes'
Database: movie_3
Note: more than 2 special features refers to Count(special_features) > 2;
Question: Please list the titles of all the films that have more than 2 special features.
SQL: SELECT title FROM ( SELECT title, count(special_features) AS num FROM film GROUP BY title ) AS t ORDER BY t.num > 2
Database: movie_3
Question: What is the email address of the staff Jon Stephens?
SQL: SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens'
Database: movie_3
Note: full name refers to first_name, last_name; active staff refers to active = 1;
Question: Please give the full names of all the active staff.
SQL: SELECT first_name, last_name FROM staff WHERE active = 1
Database: movie_3
Note: highest replacement_cost refers to Max (replacement_cost); year refers to release_year;
Question: In which year was the film with the highest replacement cost released?
SQL: SELECT DISTINCT release_year FROM film WHERE replacement_cost = ( SELECT max(replacement_cost) FROM film )
Database: movie_3
Note: highest replacement_cost refers to Max (replacement_cost); film refers to title;
Question: Please list the titles of the top 3 films with the highest replacement cost.
SQL: SELECT title FROM film WHERE replacement_cost = ( SELECT max(replacement_cost) FROM film ) LIMIT 3
Database: movie_3
Note: "ACADEMY DINOSAUR" is the title of film; language refers to language.name;
Question: What is the language of the film ACADEMY DINOSAUR?
SQL: SELECT LANGUAGE.name FROM film INNER JOIN LANGUAGE ON film.language_id = LANGUAGE.language_id WHERE film.title = 'ACADEMY DINOSAUR'
Database: movie_3
Note: "English" is the name of language;
Question: How many films are in English?
SQL: SELECT count(film.film_id) FROM film INNER JOIN LANGUAGE ON film.language_id = LANGUAGE.language_id WHERE LANGUAGE.name = 'English'
Database: movie_3
Question: Please list the titles of all the films starring the actor PENELOPE GUINESS.
SQL: SELECT film.title FROM film_actor INNER JOIN film ON film_actor.film_id = film.film_id INNER JOIN actor ON film_actor.actor_id = actor.actor_id WHERE actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS'
Database: movie_3
Note: "ACADEMY DINOSAUR" is the title of film;
Question: How many actors have starred in the film ACADEMY DINOSAUR?
SQL: SELECT count(film_actor.actor_id) FROM film_actor INNER JOIN film ON film_actor.film_id = film.film_id WHERE film.title = 'ACADEMY DINOSAUR'
Database: movie_3
Note: full name refers to first_name, last_name; "ACADEMY DINOSAUR" is the title of film;
Question: Please list the full names of all the actors that have starred in the film ACADEMY DINOSAUR.
SQL: SELECT actor.first_name, actor.last_name FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id WHERE film.title = 'ACADEMY DINOSAUR'
Database: movie_3
Note: release in 2006 refers to release_year = 2006;
Question: Among the films starring PENELOPE GUINESS, how many of them are released in 2006?
SQL: SELECT count(film_actor.film_id) FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id WHERE film.release_year = 2006 AND actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS'
Database: movie_3
Note: highest replacement cost refers to Max (replacement_cost);
Question: Please give the title of the film starring PENELOPE GUINESS and has the highest replacement cost.
SQL: SELECT film.title FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id WHERE actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS' ORDER BY film.replacement_cost DESC LIMIT 1
Database: movie_3
Note: highest replacement cost refers to Max (replacement_cost); full name refers to first_name, last_name;
Question: Please list the full names of all the actors that have starred in the film with the highest replacement cost.
SQL: SELECT first_name, last_name FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id ORDER BY film.replacement_cost DESC LIMIT 1
Database: movie_3
Note: "English" is the name of language;
Question: Among the films starring PENELOPE GUINESS, how many of them are in English?
SQL: SELECT count(film.film_id) FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id INNER JOIN LANGUAGE ON film.language_id = LANGUAGE.language_id WHERE LANGUAGE.name = 'English' AND actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS'
Database: movie_3
Note: longest duration of film refers to Max(length);
Question: What is the title of the film with the longest duration time and stars PENELOPE GUINESS?
SQL: SELECT film.title FROM actor INNER JOIN film_actor ON actor.actor_id = film_actor.actor_id INNER JOIN film ON film_actor.film_id = film.film_id WHERE actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS' ORDER BY film.length DESC LIMIT 1
Database: movie_3
Note: "Horror" is the name of category;
Question: Please list the titles of all the films in the category of "Horror".
SQL: SELECT film.title FROM film INNER JOIN film_category ON film.film_id = film_category.film_id INNER JOIN category ON film_category.category_id = category.category_id WHERE category.name = 'Horror'
Database: movie_3
Note: "Horror" is the name of category;
Question: How many films are there under the category of "Horror"?
SQL: SELECT count(film_category.film_id) FROM film_category INNER JOIN category ON film_category.category_id = category.category_id WHERE category.name = 'Horror'
Database: movie_3
Note: "Horror" is the name of category; rental rate of $2.99 refers to rental_rate = 2.99;
Question: Please list the titles of all the films under the category of "Horror" and has a rental rate of $2.99.
SQL: SELECT film.title FROM film INNER JOIN film_category ON film.film_id = film_category.film_id INNER JOIN category ON film_category.category_id = category.category_id WHERE category.name = 'Horror' AND film.rental_rate = 2.99
Database: movie_3
Note: times of rented refers to Count(rental_id);
Question: For how many times has the customer RUTH MARTINEZ rented a film?
SQL: SELECT count(rental.rental_id) FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id WHERE customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ'
Database: movie_3
Question: Please list the titles of all the films that the customer RUTH MARTINEZ has rented.
SQL: SELECT film.title FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id INNER JOIN film ON inventory.film_id = film.film_id WHERE customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ'
Database: movie_3
Note: release in 2006 refers to release_year = 2006;
Question: Among the films that the customer RUTH MARTINEZ has rented, how many of them are released in 2006?
SQL: SELECT count(customer.customer_id) FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id INNER JOIN film ON inventory.film_id = film.film_id WHERE film.release_year = 2006 AND customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ'
Database: movie_3
Note: highest replacement cost refers to Max(replacement_cost);
Question: Among the films that the customer RUTH MARTINEZ has rented, what is the title of the one with the highest replacement cost?
SQL: SELECT film.title FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id INNER JOIN film ON inventory.film_id = film.film_id WHERE customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ' ORDER BY film.replacement_cost DESC LIMIT 1
Database: movie_3
Note: full name refers to first_name, last_name; highest replacement cost refers to Max(replacement_cost);
Question: Please list the full names of all the customers who have rented the film with the highest replacement cost.
SQL: SELECT customer.first_name, customer.last_name FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id INNER JOIN film ON inventory.film_id = film.film_id ORDER BY film.replacement_cost DESC LIMIT 1
Database: movie_3
Note: returned in August, 2005 refers to year(return_date) = 2005 and month (return_date) = 8;
Question: How many films rented to the customer RUTH MARTINEZ were returned in August, 2005?
SQL: SELECT count(customer.customer_id) FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id WHERE customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ' AND strftime('%m',rental.return_date) = '8' AND strftime('%Y', rental.return_date) = '2005'
Database: movie_3
Note: full name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id));
Question: Please give the full name of the customer that have rented the most films.
SQL: SELECT t.first_name, t.last_name FROM ( SELECT customer.first_name, customer.last_name, count(rental.rental_id) AS num FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id GROUP BY customer.first_name, customer.last_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: "ACADEMY DINOSAUR" is the title of film; customer refers to customer_id; active refers to active = 1;
Question: Among the customers who have rented the film ACADEMY DINOSAUR, how many of them are active?
SQL: SELECT count(customer.customer_id) FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id INNER JOIN inventory ON rental.inventory_id = inventory.inventory_id INNER JOIN film ON inventory.film_id = film.film_id WHERE customer.active = 1 AND film.title = 'ACADEMY DINOSAUR'
Database: movie_3
Note: film refers to title; film rented the most times refers to title where Max(Count(rental_id));
Question: Which film is rented for the most times by the customers? Please give its title.
SQL: SELECT t.title FROM ( SELECT film.title, count(rental.rental_id) AS num FROM film INNER JOIN inventory ON film.film_id = inventory.film_id INNER JOIN rental ON inventory.inventory_id = rental.inventory_id GROUP BY film.title ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: rented more movie Max(Count(customer_id)); "RUTH MARTINEZ" and "LINDA WILLIAMS" are both full name of customer;
Question: Which customer has rented more movies, RUTH MARTINEZ or LINDA WILLIAMS?
SQL: SELECT t.first_name, t.last_name FROM ( SELECT customer.first_name, customer.last_name, count(customer.customer_id) AS num FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id WHERE (customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ') OR (customer.first_name = 'LINDA' AND customer.last_name = 'WILLIAMS') GROUP BY customer.first_name, customer.last_name ) AS t ORDER BY t.num DESC LIMIT 1