db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
movie_3
Among all the films starring PENELOPE GUINESS, what is the title of the one with the highest rental price per day?
highest rental price per day refers to Max(Divide(rental_rate, rental_duration))
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS' ORDER BY T3.rental_rate / T3.rental_duration DESC LIMIT 1
movie_3
What is the average replacement cost of the films under the category of "Horror"?
"Horror" is the name of category; average replacement cost = Divide (Sum(replacement_cost), Count(film_id where name = Horror))
SELECT AVG(T3.replacement_cost) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Horror'
movie_3
What is the average duration time of the films starring PENELOPE GUINESS?
average duration time = AVG(length)
SELECT AVG(T3.length) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'
movie_3
What is Diane Collins' email address?
SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'
movie_3
Give the number of inactive customers.
inactive refers to active = 0
SELECT COUNT(customer_id) FROM customer WHERE active = 0
movie_3
Who is the owner of email address "JEREMY.HURTADO@sakilacustomer.org"? Give the full name.
"JEREMY.HURTADO@sakilacustomer.org" is the email; owner refers to customer; full name refers to first_name, last_name
SELECT first_name, last_name FROM customer WHERE email = 'JEREMY.HURTADO@sakilacustomer.org'
movie_3
Give the postal code for the address No.65.
address no. 65 refers to address_id = 65
SELECT postal_code FROM address WHERE address_id = 65
movie_3
State the number of addresses in the Nordrhein-Westfalen district.
number of address refers to address_id
SELECT COUNT(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'
movie_3
What is the phone number of address No.72?
address no. 72 refers to address_id = 72; phone number refers to phone
SELECT phone FROM address WHERE address_id = '72'
movie_3
State the number of films that are 178 minutes long.
178 min long refers to length = '178'
SELECT COUNT(film_id) FROM film WHERE length = '178'
movie_3
Tell the special features of the film Uprising Uptown.
"UPRISING UPTOWN" is the title of film
SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'
movie_3
What is the description of the film Artist Coldblooded?
"ARTIST COLDBLOODED" is the title of film
SELECT description FROM film WHERE title = 'ARTIST COLDBLOODED'
movie_3
Give the detailed address for store No.2.
store no. 22 refers to store_id = 2; detailed address refers to address, address2, district
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2
movie_3
Which continent is the mother country of Clarksville city in?
"Clarksville" is the city;
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Clarksville'
movie_3
The actor Dan Harris played in a 77 minute film with replacement cost of 9.99, what was the rating for that film?
77 min film refers to length = 77
SELECT T3.rating FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'DAN' AND T1.last_name = 'HARRIS' AND T3.length = 77 AND T3.replacement_cost = '9.99'
movie_3
How many films did actor Daryl Wahlberg appear in?
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'DARYL' AND T2.last_name = 'WAHLBERG'
movie_3
Sherri Rhodes rented a film at 12:27:27 on 2005/7/28, when did she/he return that film?
rented at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27'
SELECT T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'SHERRI' AND T1.last_name = 'RHODES' AND T2.rental_date = '2005-07-28 12:27:27'
movie_3
Give the name of the manager staff for store No.1.
store no. 1 refers to store_id = 1; name refers to first_name, last_name
SELECT T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1
movie_3
State the address location of store No.1.
store no. 1 refers to store_id = 1; address location refers to address, address2, district
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1
movie_3
Where does the staff Jon Stephens live?
location refers to address, address2, district
SELECT T1.address, T1.address2 FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
movie_3
How many addresses are there in Woodridge city?
"Woodridge" is the city
SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'
movie_3
How many films are in English?
"English" is the name of language
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'
movie_3
Give the address location of Heather Morris.
address location refers to address
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'
movie_3
Give the email address of the person who lives in "1411 Lillydale Drive".
"1411 Lillydate Drive" is the address
SELECT T2.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'
movie_3
How much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?
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
SELECT T1.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297
movie_3
Which category does the film Working Microcosmos belong to?
"WORKING MICROCOSMOS" is the title of film; category refers to name
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'WORKING MICROCOSMOS'
movie_3
Give the number of documentary films.
"Documentary" is the name of category; number of film refers to Count(film_id)
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Documentary'
movie_3
State the name of the category which has the most number of films.
category refers to name; most number of films refers to Max(Count(film_id))
SELECT T.name FROM ( SELECT T2.name, COUNT(T1.film_id) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Give the name of the film for inventory No.3479.
inventory no. 3479 refers to inventory_id = '3479'; name of film refers to title
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479
movie_3
How many actors starred in the film id 508?
SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508
movie_3
What are the special features for the film "Smoochy Control"?
"SMOOCHY CONTROL" is the title of film
SELECT special_features FROM film WHERE title = 'SMOOCHY CONTROL'
movie_3
List the names of the films that are more than 180 minutes long.
more than 180 min long refers to length > 180; name of film refers to title
SELECT title FROM film WHERE length > 180
movie_3
How much is the total rental payment for the first 10 rentals?
first 10 rental refers to rental id between 1 and 10; total rental payment refers to sum(amount)
SELECT SUM(amount) FROM payment WHERE rental_id BETWEEN 1 AND 10
movie_3
What are the full names of all the active employees?
active employee refers to active = 1; full name refers to first_name, last_name
SELECT first_name, last_name FROM staff WHERE active = 1
movie_3
Who is the staff manager in store id 2?
staff manager refers to manager_staff_id
SELECT manager_staff_id FROM store WHERE store_id = 2
movie_3
How many rentals were returned on 5/27/2005?
return on 5/27/2005 refers to return_date = '2005-05-27'; rental refers to rental_id
SELECT COUNT(rental_id) FROM rental WHERE rental_date = '2005-05-27'
movie_3
List the name of the films that can only be found in store id 2.
name of film refers to title
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2
movie_3
How many films are categorized as horror?
"Horror" is the name of category
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'
movie_3
What is the name of the most rented movie?
most rented movie refers to title where Max(Count(rental_id))
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
What is the full name of the actor who starred in most movies?
full name refers to first_name, last_name; actor who starred in the most movies refers to actor_id where Max(Count(film_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Among the films with a rental duration of 7 days, how many are comedies?
rental duration of 7 refers to rental_duration = 7; comedies refers to name = 'Comedy'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration = 7 AND T3.name = 'Comedy'
movie_3
Who is the staff manager of the store with the most non-active customers?
most non-active customer refers to Max(Count(active = 0))
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
What is the rental price per day of the most expensive children's film?
children's film refers to name = 'Children'; average price per day of most expensive film = Max(Divide(rental_rate, rental_duration))
SELECT T1.rental_rate FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Children' ORDER BY T1.rental_rate / T1.rental_duration DESC LIMIT 1
movie_3
What is the complete address of store id 1?
complete address refers to address, address2, district
SELECT T3.address, T3.address2, T3.district FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN store AS T4 ON T3.address_id = T4.address_id WHERE T4.store_id = 1
movie_3
How many customers are from the city of Lethbridge?
customer refers to customer_id
SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Lethbridge'
movie_3
How many cities are there in the United States?
"United States" is the country
SELECT COUNT(T2.city) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'United States'
movie_3
List the names of the customers from India.
"India" is the country; name refers to first_name, last_name
SELECT T4.first_name, T4.last_name FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id WHERE T1.country = 'India'
movie_3
Among the classic movies, how many movies have a rental rate of less than 1?
classic movie refers to name = 'Classics'; rental rate of less than 1 refers to rental_rate < 1; movie refers to film_id
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate < 1 AND T2.name = 'Classics'
movie_3
What is the full name of the customer who rented the highest number of movies of all time?
full name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
How many times was "Blanket Beverly" rented?
"BLANKET BEVERLY" is the title of film; rented times refers to count(rental_id)
SELECT COUNT(T3.rental_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.title = 'Blanket Beverly'
movie_3
What is the full name of the actor who has the highest number of restricted films?
restricted refers to rating = 'R'; highest number of film refers to Max(Count(film_id)); full name refers to first_name, last_name
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'R' GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
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.
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)
SELECT T.first_name, T.last_name, num FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 5
movie_3
List the actors' IDs who have "KILMER" as last name.
SELECT actor_id FROM actor WHERE last_name = 'KILMER'
movie_3
List down the films titles with the lowest replacement cost under the general audiences rating.
lowest replacement cost refers to Min(replacement_cost); under general audience rating refers to rating = G
SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) FROM film )
movie_3
Among the films with the longest duration, list any five title with their descriptions and special features.
longest duration of film refers to Max(length)
SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) LIMIT 5
movie_3
How many films rented on 26th May, 2005 were returned on 30th May, 2005?
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)
SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-30'
movie_3
Calculate the average payment amount per customer.
average payment refers to AVG(amount)
SELECT AVG(amount) FROM payment GROUP BY customer_id
movie_3
What is the name and email of the staff in store ID 2?
name refers to first_name, last_name
SELECT first_name, last_name, email FROM staff WHERE store_id = 2
movie_3
What is the description and film title of ID 996?
ID 996 refers to film_id = 996
SELECT description, title FROM film_text WHERE film_id = 996
movie_3
List down the actors' full names who performed in "CHOCOLATE DUCK" film.
"CHOCOLATE DUCK" is the title of film; full name refers to first_name, last_name
SELECT T3.first_name, T3.last_name 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 T2.title = 'CHOCOLATE DUCK'
movie_3
How many films in the horror category were included in PG-13-rated?
"Horror" is the name of category; PG-13 rated refers to rating = 'PG-13'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror' AND T1.rating = 'PG-13'
movie_3
Write down any five film names under the documentary category.
"Documentary" is the name of category; film name refers to title
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' LIMIT 5
movie_3
Mention the language of Untouchables Sunrise film and calculate its rental cost per day.
"UNTOUCHABLES SUNRISE" is the title of film; language refers to name; rental cost per day = Divide (rental_cost, rental_duration)
SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'
movie_3
Write down the inventories' IDs and actors' names of "STREETCAR INTENTIONS".
"STREETCAR INTENTIONS" is the title of film; actor's names refers to first_name, last_name
SELECT T4.inventory_id, T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T2.film_id = T4.film_id WHERE T3.title = 'STREETCAR INTENTIONS'
movie_3
How many rental IDs belong to Eleanor Hunt?
'Eleanor Hunt' is the full name of a customer; full name refers to first_name, last_name
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Eleanor' AND T2.last_name = 'Hunt'
movie_3
Describe the full names and cities of the customers who rented "DREAM PICKUP".
full name refers to first_name, last_name; 'DREAM PICKUP' is a title of film
SELECT T4.first_name, T4.last_name, T6.city FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'
movie_3
Provide the full names and emails of customers whose payments were greater than 70% of the average.
full name refers to first_name, last_name; average payment refers to AVG(amount); payments were greater than 70% of the average refers to amount > (AVG(amount) MULTIPLY 0.7)
SELECT DISTINCT T2.first_name, T2.last_name, T2.email FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id WHERE T1.amount > ( SELECT AVG(amount) FROM payment ) * 0.7
movie_3
How many films have a rental rate of 0.99?
SELECT COUNT(film_id) FROM film WHERE rental_rate = 0.99
movie_3
Among the customers with customer ID of 100 and below, how many of them have Thomas as their last name?
customer ID of 100 and below refers to customer_id < 100
SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100
movie_3
List the actor's last name that starred the film with the description of "A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies".
SELECT T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.description = 'A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies'
movie_3
Among films with store ID of 2, list the title of films with the highest rental rate.
highest rental rate refers to MAX(rental_rate)
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1
movie_3
In films with a length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?
length duration of 113 minutes refers to length = 113; 'Kirk Jovovich' is a full name of an actor; full name refers to first_name, last_name
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'
movie_3
In the film with an inventory ID between 20 to 60, how many of the films have a G rating?
G rating refers to rating = 'G'
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id BETWEEN 20 AND 60 AND T1.rating = 'G'
movie_3
Among films with a rental rate of 4.99, what is the total number of films starred by Bob Fawcett?
Bob Fawcett' is a full name of an actor; full name refers to first_name, last_name
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rental_rate = 4.99 AND T1.first_name = 'Bob' AND T1.last_name = 'Fawcett'
movie_3
What is the store and inventory ID of the film with the longest duration?
the longest duration refers to MAX(length)
SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1
movie_3
List the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed films.
average rental rate of all listed films refers to AVG(rental_rate); rental rate greater than the 60% of average rental rate refers to rental_rate > (AVG(rental_rate)) MULTIPLY 0.6
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 )
movie_3
List the address in Texas in the ascending order of city id.
'Texas' is a district
SELECT address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' )
movie_3
Please list the top ten movies with the most price per day in descending order of price per day.
movies with the most price per day refers to MAX(rental_rate)
SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 10
movie_3
Calculate the average rent amount paid by the customer with customer id 15.
average rent amount refers to AVG(amount)
SELECT AVG(amount) FROM payment WHERE customer_id = 15
movie_3
How many customers rented for an above-average period?
rented period refers to SUBTRACT(return_date, rental_date); calculation = rented period > (AVG(rented period))
SELECT COUNT(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental )
movie_3
Give the full name of the actor who acted in the most number of movies?
full name refers to first_name, last_name; acted in the most number of movies refers to MAX(COUNT(film_id))
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Give the full name of the actor who acted the most in drama movies?
full name refers to first_name, last_name; drama is a category of a film; acted the most in a movies refers to MAX(COUNT(film_id))
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id WHERE T3.category_id = 7 GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Find and list the full name of customers who rented more than five types of movies.
full name refers to first_name, last_name; types of movies means category of movies; rented more than five types of movies refers to COUNT(film_category) > 5
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id GROUP BY T1.first_name, T1.last_name ) AS T WHERE T.num > 5
movie_3
In children's movies, which was rented the most?
children is the name of the category; rented the most refers to MAX(COUNT(title))
SELECT T.title FROM ( SELECT T4.title, COUNT(T4.title) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id INNER JOIN category AS T6 ON T5.category_id = T6.category_id WHERE T6.name = 'Children' GROUP BY T4.title ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Calculate the percentage of customers who paid more than the average rent amount in store 1.
store 1 refers to store_id = 1; average rent amount refers to AVG(amount); calculation = DIVIDE(amount > AVG(amount), COUNT(customer_id)) * 100
SELECT CAST(( SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T2.amount > ( SELECT AVG(amount) FROM payment ) ) AS REAL) * 100 / ( SELECT COUNT(customer_id) FROM customer )
movie_3
Indicate the title of all the films rated as 'Adults Only'.
'Adults Only' refers to rating = 'NC-17'
SELECT title FROM film WHERE rating = 'NC-17'
movie_3
How many actors with the surname Kilmer are there?
surname means last_name;
SELECT COUNT(actor_id) FROM actor WHERE last_name = 'Kilmer'
movie_3
How many movies have a length longer than 100?
length longer than 100 refers to length > 100
SELECT COUNT(film_id) FROM film WHERE length > 100
movie_3
To which country does the address '1386 Nakhon Sawan Boulevard' belong?
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id WHERE T3.address = '1386 Nakhon Sawan Boulevard'
movie_3
Indicate the title of all the films that are in the Classics category.
'classics' is the name of category
SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'
movie_3
How many rentals did Ella Oliver hire in June 2016?
'Ella Oliver' is a full name of a customer; full name refers to first_name, last_name; rental hired in June 2016 refers to rental_date BETWEEN '2005-06-01' AND '2005-06-30'
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'ELLA' AND T2.last_name = 'ELLA' AND date(T1.rental_date) BETWEEN '2005-06-01' AND '2005-06-30'
movie_3
How many different clients have rented materials from Jon Stephens?
'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name;
SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
movie_3
What is the total amount paid for rentals made on July 29, 2005?
July 29, 2005 refers to rental_date like '2005-07-29'
SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'
movie_3
What is the first name of the customers whose address is in the postal code that begins with 76?
postal code that begins with 76 refers to postal_code like '76%'
SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'
movie_3
On what date was the rented material for the movie BLOOD ARGONAUTS returned?
'BLOOD ARGONAUTS' is a title of a film; date a movie was returned refers to return_date
SELECT T1.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'
movie_3
How many actors acted in movies in the Music category?
Music' is a name of a category
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'
movie_3
What is the full name of the actor who has acted the most times in comedy films?
full name refers to first_name, last_name; 'comedy' is a name of a category;
SELECT T.first_name, T.last_name FROM ( SELECT T4.first_name, T4.last_name, COUNT(T2.actor_id) AS num FROM film_category AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN actor AS T4 ON T2.actor_id = T4.actor_id WHERE T3.name = 'Comedy' GROUP BY T4.first_name, T4.last_name ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
How many customers did not rent material at Mike's store?
not at Mike's store refers to staff.first_name ! = 'Mike'
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id WHERE T3.first_name != 'Mike'
movie_3
Indicate the name of the actors of the films rated as 'Parents Strongly Precautioned' with the highest replacement cost.
name refers to first_name, last_name; Parents Strongly Precautioned' refers to rating = 'PG-13'; highest replacement cost refers to MAX(replacement_cost)
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'PG-13' ORDER BY T3.replacement_cost DESC LIMIT 1
movie_3
What is the name of the client who has the largest quantity of rented material without returning it?
name refers to first_name, last_name; without returning a rented material refers to return_date is null
SELECT T.first_name FROM ( SELECT T2.first_name, COUNT(T1.rental_date) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name ) AS T ORDER BY T.num DESC LIMIT 1