question
stringlengths
24
325
sql
stringlengths
30
804
db_id
stringclasses
63 values
prompt
stringlengths
308
18.9k
question_id
int64
167
9.43k
difficulty
stringclasses
1 value
Who are the actors of film titled "BIRD INDEPENDENCE"?
SELECT T3.first_name, T3.last_name FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T2.actor_id = T3.actor_id WHERE T1.title = 'BIRD INDEPENDENCE'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Who are the actors of film titled "BIRD INDEPENDENCE"?
9,357
Calculate the total rental rate for animation film titles.
SELECT SUM(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` = 'Animation'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Calculate the total rental rate for animation film titles.
9,358
What is the average rental rate of sci-fi film titles?
SELECT AVG(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 T3.category_id = T2.category_id WHERE T3.`name` = 'Sci-Fi'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the average rental rate of sci-fi film titles?
9,359
What is the percentage of horror film titles in English film titles?
SELECT CAST(SUM(IIF(T3.name = 'Horror', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) 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 INNER JOIN language AS T4 ON T2.language_id = T4.language_id WHERE T4.name = 'English'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the percentage of horror film titles in English film titles?
9,360
Among the adult films, how many of them have a rental duration of fewer than 4 days?
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND rental_duration < 4
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among the adult films, how many of them have a rental duration of fewer than 4 days?
9,361
What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99?
SELECT title FROM film WHERE replacement_cost = 29.99 AND rating = 'R' AND length = 71
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99?
9,362
Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM.
SELECT T2.email FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.rental_date BETWEEN '2005-5-25 07:37:47' AND '2005-5-26 10:06:49' AND T2.active = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM.
9,363
Compute the total payment made by Sarah Lewis for film rentals so far.
SELECT SUM(T3.amount) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN payment AS T3 ON T1.rental_id = T3.rental_id WHERE T2.first_name = 'SARAH' AND T2.last_name = 'LEWIS'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Compute the total payment made by Sarah Lewis for film rentals so far.
9,364
From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_date BETWEEN '2005-05-30 03:43:54' AND '2005-07-31 10:08:29'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals?
9,365
Tally the full names of actors in the film "Alabama Devil."
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ALABAMA DEVIL'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Tally the full names of actors in the film "Alabama Devil."
9,366
Tell me the title of the film in which Sandra Kilmer is one of the actors.
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'SANDRA' AND T2.last_name = 'KILMER'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Tell me the title of the film in which Sandra Kilmer is one of the actors.
9,367
How many documentary films are rated 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 = 'Documentary' AND T1.rating = 'PG-13'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many documentary films are rated PG-13?
9,368
Give me the title and category name of films whose price per day is more than $30. Please include their special features.
SELECT T1.title, T3.name, T1.special_features 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 * T1.rental_rate > 30
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Give me the title and category name of films whose price per day is more than $30. Please include their special features.
9,369
Name the cast members of the movie 'African Egg'.
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'AFRICAN EGG'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Name the cast members of the movie 'African Egg'.
9,370
Identify the number of movies rented by Maria Miller.
SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Identify the number of movies rented by Maria Miller.
9,371
Name the most recent movie rented by Dorothy Taylor.
SELECT T4.title 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 WHERE T1.first_name = 'DOROTHY' AND T1.last_name = 'TAYLOR' ORDER BY T2.rental_date DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Name the most recent movie rented by Dorothy Taylor.
9,372
Determine the number of action movies available for rent.
SELECT COUNT(T2.film_id) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id WHERE T1.name = 'Action'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Determine the number of action movies available for rent.
9,373
Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate.
SELECT T2.store_id, T1.address, T4.rental_rate FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id INNER JOIN inventory AS T3 ON T2.store_id = T3.store_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'WYOMING STORM'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate.
9,374
How long did Austin Cintron take to return the movie 'Destiny Saturday'?
SELECT T2.rental_date - T2.return_date 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 WHERE T1.first_name = 'AUSTIN' AND T4.title = 'DESTINY SATURDAY'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How long did Austin Cintron take to return the movie 'Destiny Saturday'?
9,375
Identify the number of movies that starred Nick Stallone.
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id AND T2.first_name = 'NICK' AND T2.last_name = 'STALLONE'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Identify the number of movies that starred Nick Stallone.
9,376
Name the movie with the highest rental revenue among the shortest films.
SELECT title FROM film WHERE length = ( SELECT MIN(length) FROM film ) ORDER BY rental_duration * rental_rate DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Name the movie with the highest rental revenue among the shortest films.
9,377
Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005.
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'STEPHANIE' AND T2.last_name = 'MITCHELL' AND SUBSTR(T1.payment_date, 1, 7) = '2005-06'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005.
9,378
What is the average replacement cost for the movies with a rental rate of 4.99?
SELECT AVG(replacement_cost) FROM film WHERE rental_rate = 4.99
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the average replacement cost for the movies with a rental rate of 4.99?
9,379
What is the average rental rate for PG-13 rated movies?
SELECT AVG(rental_rate) FROM film WHERE rating = 'PG-13'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the average rental rate for PG-13 rated movies?
9,380
Indicate the percentage of inactive customers at store no.1.
SELECT CAST(SUM(CASE WHEN active = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(customer_id) FROM customer WHERE store_id = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Indicate the percentage of inactive customers at store no.1.
9,381
For how long can you rent the movie 'Dirty Ace'?
SELECT rental_duration FROM film WHERE title = 'DIRTY ACE'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # For how long can you rent the movie 'Dirty Ace'?
9,382
Identify the full name of the customer, who has the following email address: SHEILA.WELLS@sakilacustomer.org.
SELECT first_name, last_name FROM customer WHERE email = 'SHEILA.WELLS@sakilacustomer.org'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Identify the full name of the customer, who has the following email address: SHEILA.WELLS@sakilacustomer.org.
9,383
Provide the list of the longest movies. Arrange these titles in alphabetical order.
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Provide the list of the longest movies. Arrange these titles in alphabetical order.
9,384
How many film categories are there?
SELECT COUNT(DISTINCT category_id) FROM category
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many film categories are there?
9,385
How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
9,386
How many customers are still active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many customers are still active?
9,387
List all the films that are rated as PG-13.
SELECT title FROM film WHERE rating = 'PG-13'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List all the films that are rated as PG-13.
9,388
List at least 10 films that the customers can rent for more than 5 days.
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_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 WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List at least 10 films that the customers can rent for more than 5 days.
9,389
List all the cities that belong to United Arab Emirates.
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'United Arab Emirates'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List all the cities that belong to United Arab Emirates.
9,390
List at least 5 customers who paid greater than $10. Provide the full name of the customers.
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.amount > 10
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List at least 5 customers who paid greater than $10. Provide the full name of the customers.
9,391
What films did Burt Dukakis got star in?
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'BURT' AND T2.last_name = 'DUKAKIS'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What films did Burt Dukakis got star in?
9,392
Provide the full name of all the actors of the film "Ending Crowds".
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ENDING CROWDS'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Provide the full name of all the actors of the film "Ending Crowds".
9,393
Who are the actors starred in the film "Bound Cheaper"?
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.title = 'BOUND CHEAPER'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Who are the actors starred in the film "Bound Cheaper"?
9,394
List all the films that Karl Berr starred in and rated as PG.
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 = 'KARL' AND T1.last_name = 'BERRY' AND T3.rating = 'PG'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List all the films that Karl Berr starred in and rated as PG.
9,395
List at least 3 cities under the country of Philippines.
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'Philippines'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List at least 3 cities under the country of Philippines.
9,396
What are the films that are least rented by the customers?
SELECT T.title FROM ( SELECT T3.title, COUNT(T1.customer_id) AS num 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 GROUP BY T3.title ) AS T ORDER BY T.num DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What are the films that are least rented by the customers?
9,397
List all the description of the films starring Lucille Tracy?
SELECT T1.film_id FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'LUCILLE' AND T2.last_name = 'TRACY'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List all the description of the films starring Lucille Tracy?
9,398
Which category is the film "Beach Heartbreakers" falls into?
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 = 'BEACH HEARTBREAKERS'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Which category is the film "Beach Heartbreakers" falls into?
9,399
List at least 10 films that falls into the Horror category.
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 = 'Horror'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List at least 10 films that falls into the Horror category.
9,400
Who among the actors starred in a NC-17 rated film? Provide only the last name of the actors.
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.rating = 'NC-17'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Who among the actors starred in a NC-17 rated film? Provide only the last name of the actors.
9,401
Calculate the average rate of renting the film that Lucille Tracy got starred.
SELECT AVG(T3.rental_rate) 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 = 'LUCILLE' AND T1.last_name = 'TRACY'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Calculate the average rate of renting the film that Lucille Tracy got starred.
9,402
How many films have a duration between 100 to 110 minutes?
SELECT COUNT(film_id) FROM film WHERE length BETWEEN 100 AND 110
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many films have a duration between 100 to 110 minutes?
9,403
List down the actor ID of actors with Dee as their last name.
SELECT actor_id FROM actor WHERE last_name = 'Dee'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List down the actor ID of actors with Dee as their last name.
9,404
Among the active customers, how many of them have Nina as their first name?
SELECT COUNT(customer_id) FROM customer WHERE first_name = 'Nina' AND active = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among the active customers, how many of them have Nina as their first name?
9,405
In store ID 2, how many of the films are R rating?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 AND T1.rating = 'R'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # In store ID 2, how many of the films are R rating?
9,406
List the store ID of the films starred by Reese West with a duration of 100 minutes and below?
SELECT T4.store_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 inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length < 100 AND T1.first_name = 'Reese' AND T1.last_name = 'West'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List the store ID of the films starred by Reese West with a duration of 100 minutes and below?
9,407
Give the duration of the film starred by Nick Wahlberg with the highest rental rate.
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 = 'Nick' AND T1.last_name = 'Wahlberg' ORDER BY T3.rental_rate DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Give the duration of the film starred by Nick Wahlberg with the highest rental rate.
9,408
What are the titles of the films starred by Russell Close?
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'Russell' AND T2.last_name = 'Close'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What are the titles of the films starred by Russell Close?
9,409
List the store ID of the film titled "Amadeus Holy".
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'Amadeus Holy'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # List the store ID of the film titled "Amadeus Holy".
9,410
In films with a rental rate of 2.99, how many of the films are starred by Nina Soto?
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate = 2.99 AND T2.first_name = 'Nina' AND T2.last_name = 'Soto'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # In films with a rental rate of 2.99, how many of the films are starred by Nina Soto?
9,411
Among the films starred by Reese West, what is the difference between the films that have store ID of 1 and store ID of 2?
SELECT SUM(IIF(T4.film_id = 1, 1, 0)) - SUM(IIF(T4.film_id = 2, 1, 0)) AS diff FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T2.first_name = 'Reese' AND T2.last_name = 'West'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among the films starred by Reese West, what is the difference between the films that have store ID of 1 and store ID of 2?
9,412
What is the postal code of the address 692 Joliet Street?
SELECT postal_code FROM address WHERE address = '692 Joliet Street'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the postal code of the address 692 Joliet Street?
9,413
How many customers are active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many customers are active?
9,414
Among all the customers of store no.1, how many of them are active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND store_id = 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among all the customers of store no.1, how many of them are active?
9,415
What is the address of Mary Smith?
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the address of Mary Smith?
9,416
Among all the active customers, how many of them live in Arlington?
SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among all the active customers, how many of them live in Arlington?
9,417
Please list the full names of all the customers who live in Italy.
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Please list the full names of all the customers who live in Italy.
9,418
Which country does Mary Smith live in?
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Which country does Mary Smith live in?
9,419
What is the biggest amount of payment for a rental made by Mary Smith?
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the biggest amount of payment for a rental made by Mary Smith?
9,420
How many times has Mary Smith rented a film?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How many times has Mary Smith rented a film?
9,421
What is the total amount of money Mary Smith has spent on film rentals?
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the total amount of money Mary Smith has spent on film rentals?
9,422
Among the times Mary Smith had rented a movie, how many of them happened in June, 2005?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among the times Mary Smith had rented a movie, how many of them happened in June, 2005?
9,423
Please give the full name of the customer who had made the biggest amount of payment in one single film rental.
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Please give the full name of the customer who had made the biggest amount of payment in one single film rental.
9,424
How much in total had the customers in Italy spent on film rentals?
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # How much in total had the customers in Italy spent on film rentals?
9,425
Among the payments made by Mary Smith, how many of them are over 4.99?
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # Among the payments made by Mary Smith, how many of them are over 4.99?
9,426
What is the average amount of money spent by a customer in Italy on a single film rental?
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
movie_3
Database Schema: actor (actor_id integer, first_name text, last_name text, last_update datetime, , PRIMARY KEY(actor_id), ) #address (address_id integer, address text, address2 text, district text, city_id integer, postal_code text, phone text, last_update datetime, , PRIMARY KEY(address_id), FOREIGN KEY(city_id) REFERENCES city(city_id)) #category (category_id integer, name text, last_update datetime, , PRIMARY KEY(category_id), ) #city (city_id integer, city text, country_id integer, last_update datetime, , PRIMARY KEY(city_id), FOREIGN KEY(country_id) REFERENCES country(country_id)) #country (country_id integer, country text, last_update datetime, , PRIMARY KEY(country_id), ) #customer (customer_id integer, store_id integer, first_name text, last_name text, email text, address_id integer, active integer, create_date datetime, last_update datetime, , PRIMARY KEY(customer_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #film (film_id integer, title text, description text, release_year text, language_id integer, original_language_id integer, rental_duration integer, rental_rate real, length integer, replacement_cost real, rating text, special_features text, last_update datetime, , PRIMARY KEY(film_id), FOREIGN KEY(language_id) REFERENCES language(language_id), FOREIGN KEY(original_language_id) REFERENCES language(language_id)) #film_actor (actor_id integer, film_id integer, last_update datetime, , PRIMARY KEY(actor_id), PRIMARY KEY(film_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(actor_id) REFERENCES actor(actor_id)) #film_category (film_id integer, category_id integer, last_update datetime, , PRIMARY KEY(film_id), PRIMARY KEY(category_id), FOREIGN KEY(category_id) REFERENCES category(category_id), FOREIGN KEY(film_id) REFERENCES film(film_id)) #film_text (film_id integer, title text, description text, , PRIMARY KEY(film_id), ) #inventory (inventory_id integer, film_id integer, store_id integer, last_update datetime, , PRIMARY KEY(inventory_id), FOREIGN KEY(film_id) REFERENCES film(film_id), FOREIGN KEY(store_id) REFERENCES store(store_id)) #language (language_id integer, name text, last_update datetime, , PRIMARY KEY(language_id), ) #payment (payment_id integer, customer_id integer, staff_id integer, rental_id integer, amount real, payment_date datetime, last_update datetime, , PRIMARY KEY(payment_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id), FOREIGN KEY(rental_id) REFERENCES rental(rental_id)) #rental (rental_id integer, rental_date datetime, inventory_id integer, customer_id integer, return_date datetime, staff_id integer, last_update datetime, , PRIMARY KEY(rental_id), FOREIGN KEY(staff_id) REFERENCES staff(staff_id), FOREIGN KEY(inventory_id) REFERENCES inventory(inventory_id), FOREIGN KEY(customer_id) REFERENCES customer(customer_id)) #staff (staff_id integer, first_name text, last_name text, address_id integer, picture blob, email text, store_id integer, active integer, username text, password text, last_update datetime, , PRIMARY KEY(staff_id), FOREIGN KEY(store_id) REFERENCES store(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id)) #store (store_id integer, manager_staff_id integer, address_id integer, last_update datetime, , PRIMARY KEY(store_id), FOREIGN KEY(address_id) REFERENCES address(address_id), FOREIGN KEY(manager_staff_id) REFERENCES staff(staff_id)) # What is the average amount of money spent by a customer in Italy on a single film rental?
9,427