Chinastark/bird_dataset huggingface dataset:
Database: movie_3
Note: highest rental price per day refers to Max(Divide(rental_rate, rental_duration));
Question: Among all the films starring PENELOPE GUINESS, what is the title of the one with the highest rental price per day?
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.rental_rate / film.rental_duration DESC LIMIT 1
Database: movie_3
Note: "Horror" is the name of category; average replacement cost = Divide (Sum(replacement_cost), Count(film_id where name = Horror));
Question: What is the average replacement cost of the films under the category of "Horror"?
SQL: SELECT avg(film.replacement_cost) FROM film_category INNER JOIN category ON film_category.category_id = category.category_id INNER JOIN film ON film_category.film_id = film.film_id WHERE category.name = 'Horror'
Database: movie_3
Note: music film refers to name = 'Music'; percentage = Divide (Count(film_id where name = 'Music'), Count(film_id)) * 100;
Question: Among all films that the customer RUTH MARTINEZ has rented, what is the percentage of it being a Music film?
SQL: SELECT cast(sum(iif(category.name = 'Music', 1, 0)) AS REAL) * 100 / count(film.film_id) 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 INNER JOIN inventory ON film.film_id = inventory.film_id INNER JOIN customer ON inventory.store_id = customer.store_id INNER JOIN rental ON inventory.inventory_id = rental.inventory_id WHERE customer.first_name = 'RUTH' AND customer.last_name = 'MARTINEZ'
Database: movie_3
Note: average duration time = AVG(length);
Question: What is the average duration time of the films starring PENELOPE GUINESS?
SQL: SELECT avg(film.length) 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'
Database: movie_3
Question: What is Diane Collins' email address?
SQL: SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'
Database: movie_3
Note: inactive refers to active = 0;
Question: Give the number of inactive customers.
SQL: SELECT count(customer_id) FROM customer WHERE active = 0
Database: movie_3
Note: "JEREMY.HURTADO@sakilacustomer.org" is the email; owner refers to customer; full name refers to first_name, last_name;
Question: Who is the owner of email address "JEREMY.HURTADO@sakilacustomer.org"? Give the full name.
SQL: SELECT first_name, last_name FROM customer WHERE email = 'JEREMY.HURTADO@sakilacustomer.org'
Database: movie_3
Note: address no. 65 refers to address_id = 65;
Question: Give the postal code for the address No.65.
SQL: SELECT postal_code FROM address WHERE address_id = 65
Database: movie_3
Note: number of address refers to address_id;
Question: State the number of addresses in the Nordrhein-Westfalen district.
SQL: SELECT count(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'
Database: movie_3
Note: address no. 72 refers to address_id = 72; phone number refers to phone;
Question: What is the phone number of address No.72?
SQL: SELECT phone FROM address WHERE address_id = '72'
Database: movie_3
Note: 178 min long refers to length = '178';
Question: State the number of films that are 178 minutes long.
SQL: SELECT count(film_id) FROM film WHERE LENGTH = '178'
Database: movie_3
Note: "UPRISING UPTOWN" is the title of film;
Question: Tell the special features of the film Uprising Uptown.
SQL: SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'
Database: movie_3
Note: "ARTIST COLDBLOODED" is the title of film;
Question: What is the description of the film Artist Coldblooded?
SQL: SELECT description FROM film WHERE title = 'ARTIST COLDBLOODED'
Database: movie_3
Note: store no. 22 refers to store_id = 2; detailed address refers to address, address2, district;
Question: Give the detailed address for store No.2.
SQL: SELECT address.address, address.address2, address.district FROM address INNER JOIN store ON address.address_id = store.address_id WHERE store.store_id = 2
Database: movie_3
Note: "Clarksville" is the city;
Question: Which continent is the mother country of Clarksville city in?
SQL: SELECT country.country FROM country INNER JOIN city ON country.country_id = city.country_id WHERE city.city = 'Clarksville'
Database: movie_3
Note: in 2006 refers to release_year = 2006; 98 min duration refers to length = 98; number of actors refers to count(actor_id);
Question: How many actors played a role in the 2006 film whose rental duration is 7 days, rental rate is 4.99 and is 98 minutes duration?
SQL: SELECT count(film_actor.actor_id) FROM film_actor INNER JOIN film ON film_actor.film_id = film.film_id WHERE film.release_year = 2006 AND film.rental_duration = 7 AND film.rental_duration = 4.99 AND film.length = 98
Database: movie_3
Note: 77 min film refers to length = 77;
Question: The actor Dan Harris played in a 77 minute film with replacement cost of 9.99, what was the rating for that film?
SQL: SELECT film.rating 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 = 'DAN' AND actor.last_name = 'HARRIS' AND film.length = 77 AND film.replacement_cost = '9.99'
Database: movie_3
Question: How many films did actor Daryl Wahlberg appear in?
SQL: SELECT count(film_actor.film_id) FROM film_actor INNER JOIN actor ON film_actor.actor_id = actor.actor_id WHERE actor.first_name = 'DARYL' AND actor.last_name = 'WAHLBERG'
Database: movie_3
Note: rented at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27';
Question: Sherri Rhodes rented a film at 12:27:27 on 2005/7/28, when did she/he return that film?
SQL: SELECT rental.return_date FROM customer INNER JOIN rental ON customer.customer_id = rental.customer_id WHERE customer.first_name = 'SHERRI' AND customer.last_name = 'RHODES' AND rental.rental_date = '2005-07-28 12:27:27'
Database: movie_3
Note: store no. 1 refers to store_id = 1; name refers to first_name, last_name;
Question: Give the name of the manager staff for store No.1.
SQL: SELECT staff.first_name, staff.last_name FROM staff INNER JOIN store ON staff.store_id = store.store_id WHERE store.store_id = 1
Database: movie_3
Note: store no. 1 refers to store_id = 1; address location refers to address, address2, district;
Question: State the address location of store No.1.
SQL: SELECT address.address, address.address2, address.district FROM address INNER JOIN store ON address.address_id = store.address_id WHERE store.store_id = 1
Database: movie_3
Note: location refers to address, address2, district;
Question: Where does the staff Jon Stephens live?
SQL: SELECT address.address, address.address2 FROM address INNER JOIN staff ON address.address_id = staff.address_id WHERE staff.first_name = 'Jon' AND staff.last_name = 'Stephens'
Database: movie_3
Note: "Woodridge" is the city;
Question: How many addresses are there in Woodridge city?
SQL: SELECT count(address.address_id) FROM address INNER JOIN city ON address.city_id = city.city_id WHERE city.city = 'Woodridge'
Database: movie_3
Note: address location refers to address;
Question: Give the address location of Heather Morris.
SQL: SELECT address.address FROM address INNER JOIN customer ON address.address_id = customer.address_id WHERE customer.first_name = 'HEATHER' AND customer.last_name = 'MORRIS'
Database: movie_3
Note: "1411 Lillydate Drive" is the address;
Question: Give the email address of the person who lives in "1411 Lillydale Drive".
SQL: SELECT staff.email FROM address INNER JOIN staff ON address.address_id = staff.address_id WHERE address.address = '1411 Lillydale Drive'
Database: movie_3
Note: customer no. 297 refers to customer_id = 297; at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'; money pay for rent refers to amount;
Question: How much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?
SQL: SELECT payment.amount FROM payment INNER JOIN rental ON payment.rental_id = rental.rental_id WHERE rental.rental_date = '2005-07-28 12:27:27' AND rental.customer_id = 297
Database: movie_3
Note: "WORKING MICROCOSMOS" is the title of film; category refers to name;
Question: Which category does the film Working Microcosmos belong to?
SQL: SELECT category.name 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 film.title = 'WORKING MICROCOSMOS'
Database: movie_3
Note: "Documentary" is the name of category; number of film refers to Count(film_id);
Question: Give the number of documentary films.
SQL: SELECT count(film_category.film_id) FROM film_category INNER JOIN category ON film_category.category_id = category.category_id WHERE category.name = 'Documentary'
Database: movie_3
Note: category refers to name; most number of films refers to Max(Count(film_id));
Question: State the name of the category which has the most number of films.
SQL: SELECT t.name FROM ( SELECT category.name, count(film_category.film_id) AS num FROM film_category INNER JOIN category ON film_category.category_id = category.category_id GROUP BY category.name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: inventory no. 3479 refers to inventory_id = '3479'; name of film refers to title;
Question: Give the name of the film for inventory No.3479.
SQL: SELECT film.title FROM film INNER JOIN inventory ON film.film_id = inventory.film_id WHERE inventory.inventory_id = 3479
Database: movie_3
Note: store no. 1 refers to store_id = 1; store no.2 refers to store_id = 2; rental payment refers to amount; percent more = Divide (Subtract(amount where store_id = 2, amount where store_id = 1), amount where store_id = 1) *100;
Question: What is the percentage more for the rental payment for store No.2 than store No.1?
SQL: SELECT cast((sum(iif(customer.store_id = 2, payment.amount, 0)) - sum(iif(customer.store_id = 1, payment.amount, 0))) AS REAL) * 100 / sum(iif(customer.store_id = 1, payment.amount, 0)) FROM payment INNER JOIN customer ON payment.customer_id = customer.customer_id INNER JOIN store ON customer.store_id = store.store_id
Database: movie_3
Note: indian refers to country = 'India'; Italian refers to country = 'Italy'; times = Divide(Count(city where country = 'India), Count(city where country = 'Italy'));
Question: How many times is the number of Indian cities than Italian cities?
SQL: SELECT cast(sum(iif(country.country = 'India', 1, 0)) AS REAL) / sum(iif(country.country = 'Italy', 1, 0)) FROM country INNER JOIN city ON country.country_id = city.country_id
Database: movie_3
Note: "Gina DeGeneres" and "Penelope Guinness" are both full name of actor; times number of film = Divide (Count (film_id where first_name = 'GINA' and last_name = 'DEGENERES'), Count(film_id where first_name = 'PENELOPE' and last_name = 'GUINESS'));
Question: How many times is the number of films Gina DeGeneres acted in than Penelope Guinness?
SQL: SELECT cast(sum(iif(actor.first_name = 'GINA' AND actor.last_name = 'DEGENERES', 1, 0)) AS REAL) * 100 / sum(iif(actor.first_name = 'PENELOPE' AND actor.last_name = 'GUINESS', 1, 0)) FROM film_actor INNER JOIN actor ON film_actor.actor_id = actor.actor_id
Database: movie_3
Note: restricted refers to rating = 'R'; release refers to release_year; in 2006 refers to release_year = 2006; film refers to title;
Question: In 2006, how many restricted films were released?
SQL: SELECT count(film_id) FROM film WHERE rating = 'R' AND release_year = 2006
Database: movie_3
Question: How many actors starred in the film id 508?
SQL: SELECT count(actor_id) FROM film_actor WHERE film_id = 508
Database: movie_3
Note: "SMOOCHY CONTROL" is the title of film;
Question: What are the special features for the film "Smoochy Control"?
SQL: SELECT special_features FROM film WHERE title = 'SMOOCHY CONTROL'
Database: movie_3
Note: over the amount of 10 refers to amount > 10; paid on August 2005 refers to payment_date like '2005_08%'; customer refers to customer_id;
Question: How many customers paid over the amount of 10 on August 2005?
SQL: SELECT count(customer_id) FROM payment WHERE substr(payment_date, 1, 7) LIKE '2005-08'
Database: movie_3
Note: more than 180 min long refers to length > 180; name of film refers to title;
Question: List the names of the films that are more than 180 minutes long.
SQL: SELECT title FROM film WHERE LENGTH > 180
Database: movie_3
Note: first 10 rental refers to rental id between 1 and 10; total rental payment refers to sum(amount);
Question: How much is the total rental payment for the first 10 rentals?
SQL: SELECT sum(amount) FROM payment WHERE rental_id BETWEEN 1 AND 10
Database: movie_3
Note: active employee refers to active = 1; full name refers to first_name, last_name;
Question: What are the full names of all the active employees?
SQL: SELECT first_name, last_name FROM staff WHERE active = 1
Database: movie_3
Note: staff manager refers to manager_staff_id;
Question: Who is the staff manager in store id 2?
SQL: SELECT manager_staff_id FROM store WHERE store_id = 2
Database: movie_3
Note: return on 5/27/2005 refers to return_date = '2005-05-27'; rental refers to rental_id;
Question: How many rentals were returned on 5/27/2005?
SQL: SELECT count(rental_id) FROM rental WHERE rental_date = '2005-05-27'
Database: movie_3
Note: name of movie refers to title;
Question: What are the names of the movies which Laura Brody starred in?
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 = 'Laura' AND actor.last_name = 'Brody'
Database: movie_3
Note: name of film refers to title;
Question: List the name of the films that can only be found in store id 2.
SQL: SELECT film.title FROM film INNER JOIN inventory ON film.film_id = inventory.film_id WHERE inventory.store_id = 2
Database: movie_3
Note: rented for 7 consecutive days refers to Subtract(return_date, rental_date) = 7; full name refers to first_name, last_name;
Question: What is the full name of the customer who rented movies for 7 consecutive days?
SQL: SELECT customer.first_name, customer.last_name FROM customer INNER JOIN ( SELECT customer_id, count(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS t2 ON customer.customer_id = t2.customer_id
Database: movie_3
Note: "Horror" is the name of category;
Question: How many films are categorized as 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: most rented movie refers to title where Max(Count(rental_id));
Question: What is the name of the most rented movie?
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: "science fiction" is the name of category; most common special features refers to Max(frequency(special_features));
Question: What is the most common special features of science-fiction movies?
SQL: SELECT film.special_features 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 = 'sci-fi' ORDER BY film.special_features DESC LIMIT 1
Database: movie_3
Note: full name refers to first_name, last_name; actor who starred in the most movies refers to actor_id where Max(Count(film_id));
Question: What is the full name of the actor who starred in most movies?
SQL: SELECT t.first_name, t.last_name FROM ( SELECT actor.first_name, actor.last_name, count(film_actor.film_id) AS num FROM film_actor INNER JOIN actor ON film_actor.actor_id = actor.actor_id GROUP BY actor.first_name, actor.last_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: rental duration of 7 refers to rental_duration = 7; comedies refers to name = 'Comedy';
Question: Among the films with a rental duration of 7 days, how many are comedies?
SQL: SELECT count(film.film_id) 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 film.rental_duration = 7 AND category.name = 'Comedy'
Database: movie_3
Note: most non-active customer refers to Max(Count(active = 0));
Question: Who is the staff manager of the store with the most non-active customers?
SQL: SELECT t.first_name, t.last_name FROM ( SELECT staff.first_name, staff.last_name, count(customer.customer_id) AS num FROM customer INNER JOIN store ON customer.store_id = store.store_id INNER JOIN staff ON store.store_id = staff.store_id WHERE customer.active = 0 GROUP BY staff.first_name, staff.last_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: children's film refers to name = 'Children'; average price per day of most expensive film = Max(Divide(rental_rate, rental_duration));
Question: What is the rental price per day of the most expensive children's film?
SQL: SELECT film.rental_rate 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 = 'Children' ORDER BY film.rental_rate / film.rental_duration DESC LIMIT 1
Database: movie_3
Note: complete address refers to address, address2, district;
Question: What is the complete address of store id 1?
SQL: SELECT address.address, address.address2, address.district FROM country INNER JOIN city ON country.country_id = city.country_id INNER JOIN address ON city.city_id = address.city_id INNER JOIN store ON address.address_id = store.address_id WHERE store.store_id = 1
Database: movie_3
Note: customer refers to customer_id;
Question: How many customers are from the city of Lethbridge?
SQL: SELECT count(customer.customer_id) FROM city INNER JOIN address ON city.city_id = address.city_id INNER JOIN customer ON address.address_id = customer.address_id WHERE city.city = 'Lethbridge'
Database: movie_3
Note: "United States" is the country;
Question: How many cities are there in the United States?
SQL: SELECT count(city.city) FROM country INNER JOIN city ON country.country_id = city.country_id WHERE country.country = 'United States'
Database: movie_3
Note: "India" is the country; name refers to first_name, last_name;
Question: List the names of the customers from India.
SQL: SELECT customer.first_name, customer.last_name FROM country INNER JOIN city ON country.country_id = city.country_id INNER JOIN address ON city.city_id = address.city_id INNER JOIN customer ON address.address_id = customer.address_id WHERE country.country = 'India'
Database: movie_3
Note: classic movie refers to name = 'Classics'; rental rate of less than 1 refers to rental_rate < 1; movie refers to film_id;
Question: Among the classic movies, how many movies have a rental rate of less than 1?
SQL: SELECT count(film_category.film_id) FROM film_category INNER JOIN category ON film_category.category_id = category.category_id INNER JOIN film ON film_category.film_id = film.film_id WHERE film.rental_rate < 1 AND category.name = 'Classics'
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: What is the full name of the customer who rented the highest number of movies of all time?
SQL: SELECT t.first_name, t.last_name FROM ( SELECT customer.first_name, customer.last_name, count(rental.rental_id) AS num FROM rental INNER JOIN customer ON rental.customer_id = customer.customer_id GROUP BY customer.first_name, customer.last_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: "BLANKET BEVERLY" is the title of film; rented times refers to count(rental_id);
Question: How many times was "Blanket Beverly" rented?
SQL: SELECT count(rental.rental_id) FROM film INNER JOIN inventory ON film.film_id = inventory.film_id INNER JOIN rental ON inventory.inventory_id = rental.inventory_id WHERE film.title = 'Blanket Beverly'
Database: movie_3
Note: restricted refers to rating = 'R'; highest number of film refers to Max(Count(film_id)); full name refers to first_name, last_name;
Question: What is the full name of the actor who has the highest number of restricted films?
SQL: SELECT t.first_name, t.last_name FROM ( SELECT actor.first_name, actor.last_name, count(film_actor.film_id) AS num 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.rating = 'R' GROUP BY actor.first_name, actor.last_name ) AS t ORDER BY t.num DESC LIMIT 1
Database: movie_3
Note: actors with highest number of films refers to actor_id with Max(Count(film_id)); full name refers to first_name, last_name; average number of film = Divide (Count(film_id), 5);
Question: Who are the top 5 actors with the highest number of films? List their full names and calculate the average number of films for each of the actors.
SQL: SELECT t.first_name, t.last_name, num FROM ( SELECT actor.first_name, actor.last_name, count(film_actor.film_id) AS num 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 GROUP BY actor.first_name, actor.last_name ) AS t ORDER BY t.num DESC LIMIT 5
Database: movie_3
Question: List the actors' IDs who have "KILMER" as last name.
SQL: SELECT actor_id FROM actor WHERE last_name = 'KILMER'
Database: movie_3
Note: lowest replacement cost refers to Min(replacement_cost); under general audience rating refers to rating = G;
Question: List down the films titles with the lowest replacement cost under the general audiences rating.
SQL: SELECT title FROM film WHERE replacement_cost = ( SELECT min(replacement_cost) FROM film )
Database: movie_3
Note: longest duration of film refers to Max(length);
Question: Among the films with the longest duration, list any five title with their descriptions and special features.
SQL: SELECT title, description, special_features FROM film WHERE LENGTH = ( SELECT max(LENGTH) FROM film ) LIMIT 5
Database: movie_3
Note: rented on 26th May 2005 refers to rental_date = '2005-05-26'; return on 30th May, 2005 refers to return_date = '2005-05-30'; number of rented film refers to Count (rental_id);
Question: How many films rented on 26th May, 2005 were returned on 30th May, 2005?
SQL: SELECT count(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-30'
Database: movie_3
Note: average payment refers to AVG(amount);
Question: Calculate the average payment amount per customer.
SQL: SELECT avg(amount) FROM payment GROUP BY customer_id
Database: movie_3
Note: name refers to first_name, last_name;
Question: What is the name and email of the staff in store ID 2?
SQL: SELECT first_name, last_name, email FROM staff WHERE store_id = 2
Database: movie_3
Note: inactive refers to active = 0; percent = Divide (Count (customer_id where active = 0), Count(customer_id)) * 100;
Question: How many percent of customers were inactive?
SQL: SELECT cast(sum(iif(active = 0, 1, 0)) AS REAL) * 100 / count(customer_id) FROM customer
Database: movie_3
Note: ID 996 refers to film_id = 996;
Question: What is the description and film title of ID 996?
SQL: SELECT description, title FROM film_text WHERE film_id = 996
Database: movie_3
Note: in August 2005 refers to payment_date like '2005-08%'; total payment amount refers to Sum(amount);
Question: Calculate customers' total payment amount in August, 2005.
SQL: SELECT sum(amount) FROM payment WHERE substr(payment_date, 1, 7) = '2005-08'