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 |
---|---|---|---|---|---|
Give the name of the manager staff for store No.1.
|
SELECT T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1
|
movie_3
|
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 name of the manager staff for store No.1.
| 9,157 | |
State the address location of store No.1.
|
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1
|
movie_3
|
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))
#
State the address location of store No.1.
| 9,158 | |
Where does the staff Jon Stephens live?
|
SELECT T1.address, T1.address2 FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
|
movie_3
|
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 does the staff Jon Stephens live?
| 9,159 | |
How many addresses are there in Woodridge city?
|
SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'
|
movie_3
|
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 addresses are there in Woodridge city?
| 9,160 | |
How many films are in English?
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'
|
movie_3
|
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 are in English?
| 9,161 | |
Give the address location of Heather Morris.
|
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'
|
movie_3
|
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 address location of Heather Morris.
| 9,162 | |
Give the email address of the person who lives in "1411 Lillydale Drive".
|
SELECT T2.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'
|
movie_3
|
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 email address of the person who lives in "1411 Lillydale Drive".
| 9,163 | |
How much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?
|
SELECT T1.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297
|
movie_3
|
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 money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28?
| 9,164 | |
Which category does the film Working Microcosmos belong to?
|
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'WORKING MICROCOSMOS'
|
movie_3
|
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 does the film Working Microcosmos belong to?
| 9,165 | |
Give the number of documentary films.
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Documentary'
|
movie_3
|
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 number of documentary films.
| 9,166 | |
State the name of the category which has the most number of films.
|
SELECT T.name FROM ( SELECT T2.name, COUNT(T1.film_id) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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))
#
State the name of the category which has the most number of films.
| 9,167 | |
Give the name of the film for inventory No.3479.
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479
|
movie_3
|
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 name of the film for inventory No.3479.
| 9,168 | |
What is the percentage more for the rental payment for store No.2 than store No.1?
|
SELECT CAST((SUM(IIF(T2.store_id = 2, T1.amount, 0)) - SUM(IIF(T2.store_id = 1, T1.amount, 0))) AS REAL) * 100 / SUM(IIF(T2.store_id = 1, T1.amount, 0)) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN store AS T3 ON T2.store_id = T3.store_id
|
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 more for the rental payment for store No.2 than store No.1?
| 9,169 | |
How many times is the number of Indian cities than Italian cities?
|
SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) / SUM(IIF(T1.country = 'Italy', 1, 0)) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id
|
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 is the number of Indian cities than Italian cities?
| 9,170 | |
How many times is the number of films Gina DeGeneres acted in than Penelope Guinness?
|
SELECT CAST(SUM(IIF(T2.first_name = 'GINA' AND T2.last_name = 'DEGENERES', 1, 0)) AS REAL) * 100 / SUM(IIF(T2.first_name = 'PENELOPE' AND T2.last_name = 'GUINESS', 1, 0)) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id
|
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 is the number of films Gina DeGeneres acted in than Penelope Guinness?
| 9,171 | |
In 2006, how many restricted films were released?
|
SELECT COUNT(film_id) FROM film WHERE rating = 'R' AND release_year = 2006
|
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 2006, how many restricted films were released?
| 9,172 | |
How many actors starred in the film id 508?
|
SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508
|
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 actors starred in the film id 508?
| 9,173 | |
What are the special features for the film "Smoochy Control"?
|
SELECT special_features FROM film WHERE title = 'SMOOCHY CONTROL'
|
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 special features for the film "Smoochy Control"?
| 9,174 | |
How many customers paid over the amount of 10 on August 2005?
|
SELECT COUNT(customer_id) FROM payment WHERE SUBSTR(payment_date, 1, 7) LIKE '2005-08'
|
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 paid over the amount of 10 on August 2005?
| 9,175 | |
List the names of the films that are more than 180 minutes long.
|
SELECT title FROM film WHERE length > 180
|
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 names of the films that are more than 180 minutes long.
| 9,176 | |
How much is the total rental payment for the first 10 rentals?
|
SELECT SUM(amount) FROM payment WHERE rental_id BETWEEN 1 AND 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))
#
How much is the total rental payment for the first 10 rentals?
| 9,177 | |
What are the full names of all the active employees?
|
SELECT first_name, last_name FROM staff 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))
#
What are the full names of all the active employees?
| 9,178 | |
Who is the staff manager in store id 2?
|
SELECT manager_staff_id FROM store WHERE store_id = 2
|
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 is the staff manager in store id 2?
| 9,179 | |
How many rentals were returned on 5/27/2005?
|
SELECT COUNT(rental_id) FROM rental WHERE rental_date = '2005-05-27'
|
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 rentals were returned on 5/27/2005?
| 9,180 | |
What are the names of the movies which Laura Brody starred in?
|
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 = 'Laura' AND T1.last_name = 'Brody'
|
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 names of the movies which Laura Brody starred in?
| 9,181 | |
List the name of the films that can only be found in store id 2.
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2
|
movie_3
|
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 name of the films that can only be found in store id 2.
| 9,182 | |
What is the full name of the customer who rented movies for 7 consecutive days?
|
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN ( SELECT customer_id, COUNT(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS T2 ON T1.customer_id = T2.customer_id
|
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 full name of the customer who rented movies for 7 consecutive days?
| 9,183 | |
How many films are categorized as horror?
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'
|
movie_3
|
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 are categorized as horror?
| 9,184 | |
What is the name of the most rented movie?
|
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 name of the most rented movie?
| 9,185 | |
What is the most common special features of science-fiction movies?
|
SELECT 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 T3.name = 'sci-fi' ORDER BY T1.special_features 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 most common special features of science-fiction movies?
| 9,186 | |
What is the full name of the actor who starred in most movies?
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 full name of the actor who starred in most movies?
| 9,187 | |
Among the films with a rental duration of 7 days, how many are comedies?
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration = 7 AND T3.name = 'Comedy'
|
movie_3
|
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 with a rental duration of 7 days, how many are comedies?
| 9,188 | |
Who is the staff manager of the store with the most non-active customers?
|
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 is the staff manager of the store with the most non-active customers?
| 9,189 | |
What is the rental price per day of the most expensive children's film?
|
SELECT T1.rental_rate FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Children' ORDER BY T1.rental_rate / T1.rental_duration DESC LIMIT 1
|
movie_3
|
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 rental price per day of the most expensive children's film?
| 9,190 | |
What is the complete address of store id 1?
|
SELECT T3.address, T3.address2, T3.district FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN store AS T4 ON T3.address_id = T4.address_id WHERE T4.store_id = 1
|
movie_3
|
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 complete address of store id 1?
| 9,191 | |
How many customers are from the city of Lethbridge?
|
SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Lethbridge'
|
movie_3
|
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 from the city of Lethbridge?
| 9,192 | |
How many cities are there in the United States?
|
SELECT COUNT(T2.city) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'United States'
|
movie_3
|
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 cities are there in the United States?
| 9,193 | |
List the names of the customers from India.
|
SELECT T4.first_name, T4.last_name FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id WHERE T1.country = 'India'
|
movie_3
|
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 names of the customers from India.
| 9,194 | |
Among the classic movies, how many movies have a rental rate of less than 1?
|
SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate < 1 AND T2.name = 'Classics'
|
movie_3
|
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 classic movies, how many movies have a rental rate of less than 1?
| 9,195 | |
What is the full name of the customer who rented the highest number of movies of all time?
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 full name of the customer who rented the highest number of movies of all time?
| 9,196 | |
How many times was "Blanket Beverly" rented?
|
SELECT COUNT(T3.rental_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.title = 'Blanket Beverly'
|
movie_3
|
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 was "Blanket Beverly" rented?
| 9,197 | |
What is the full name of the actor who has the highest number of restricted films?
|
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'R' GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 full name of the actor who has the highest number of restricted films?
| 9,198 | |
Who are the top 5 actors with the highest number of films? List their full names and calculate the average number of films for each of the actors.
|
SELECT T.first_name, T.last_name, num FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 5
|
movie_3
|
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 top 5 actors with the highest number of films? List their full names and calculate the average number of films for each of the actors.
| 9,199 | |
List the actors' IDs who have "KILMER" as last name.
|
SELECT actor_id FROM actor WHERE 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))
#
List the actors' IDs who have "KILMER" as last name.
| 9,200 | |
List down the films titles with the lowest replacement cost under the general audiences rating.
|
SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) 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))
#
List down the films titles with the lowest replacement cost under the general audiences rating.
| 9,201 | |
Among the films with the longest duration, list any five title with their descriptions and special features.
|
SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) LIMIT 5
|
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 with the longest duration, list any five title with their descriptions and special features.
| 9,202 | |
How many films rented on 26th May, 2005 were returned on 30th May, 2005?
|
SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-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))
#
How many films rented on 26th May, 2005 were returned on 30th May, 2005?
| 9,203 | |
Calculate the average payment amount per customer.
|
SELECT AVG(amount) FROM payment GROUP BY customer_id
|
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 payment amount per customer.
| 9,204 | |
What is the name and email of the staff in store ID 2?
|
SELECT first_name, last_name, email FROM staff WHERE store_id = 2
|
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 name and email of the staff in store ID 2?
| 9,205 | |
How many percent of customers were inactive?
|
SELECT CAST(SUM(IIF(active = 0, 1, 0)) AS REAL) * 100 / COUNT(customer_id) FROM customer
|
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 percent of customers were inactive?
| 9,206 | |
What is the description and film title of ID 996?
|
SELECT description, title FROM film_text WHERE film_id = 996
|
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 description and film title of ID 996?
| 9,207 | |
Calculate customers' total payment amount in August, 2005.
|
SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'
|
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 customers' total payment amount in August, 2005.
| 9,208 | |
List down the film titles performed by Emily Dee.
|
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 = 'Emily' AND T1.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 film titles performed by Emily Dee.
| 9,209 | |
List down the actors' full names who performed in "CHOCOLATE DUCK" film.
|
SELECT T3.first_name, T3.last_name FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = 'CHOCOLATE DUCK'
|
movie_3
|
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 actors' full names who performed in "CHOCOLATE DUCK" film.
| 9,210 | |
How many films in the horror category were included in PG-13-rated?
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror' AND T1.rating = 'PG-13'
|
movie_3
|
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 in the horror category were included in PG-13-rated?
| 9,211 | |
Distinguish the films performed by Judy Dean according to category.
|
SELECT T5.name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T2.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T1.first_name = 'Judy' AND T1.last_name = 'Dean'
|
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))
#
Distinguish the films performed by Judy Dean according to category.
| 9,212 | |
Write down any five film names under the documentary 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 = 'Documentary' LIMIT 5
|
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 any five film names under the documentary category.
| 9,213 | |
Mention the language of Untouchables Sunrise film and calculate its rental cost per day.
|
SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'
|
movie_3
|
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))
#
Mention the language of Untouchables Sunrise film and calculate its rental cost per day.
| 9,214 | |
List the films' titles which were rented on 24th May,2005.
|
SELECT T1.title 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 SUBSTR(T3.rental_date, 1, 10) = '2005-05-24'
|
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 films' titles which were rented on 24th May,2005.
| 9,215 | |
List the films' titles which were rented by Brian Wyman in July, 2005.
|
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 = 'BRIAN' AND T1.last_name = 'WYMAN' AND STRFTIME('%Y', T2.rental_date) = '2005' AND STRFTIME('%m',T2.rental_date) = '7'
|
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 films' titles which were rented by Brian Wyman in July, 2005.
| 9,216 | |
Write down the inventories' IDs and actors' names of "STREETCAR INTENTIONS".
|
SELECT T4.inventory_id, T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T2.film_id = T4.film_id WHERE T3.title = 'STREETCAR INTENTIONS'
|
movie_3
|
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 inventories' IDs and actors' names of "STREETCAR INTENTIONS".
| 9,217 | |
Among the films rented by Natalie Meyer, describe the titles and categories of the films which were rented in February 2006.
|
SELECT T3.title, T2.name FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'Natalie' AND T5.last_name = 'Meyer' AND STRFTIME('%Y',T3.rental_rate) = '2006' AND STRFTIME('%m',T3.rental_rate) = '2'
|
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 rented by Natalie Meyer, describe the titles and categories of the films which were rented in February 2006.
| 9,218 | |
How many rental IDs belong to Eleanor Hunt?
|
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Eleanor' AND T2.last_name = 'Hunt'
|
movie_3
|
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 rental IDs belong to Eleanor Hunt?
| 9,219 | |
Describe the full names and cities of the customers who rented "DREAM PICKUP".
|
SELECT T4.first_name, T4.last_name, T6.city FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'
|
movie_3
|
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))
#
Describe the full names and cities of the customers who rented "DREAM PICKUP".
| 9,220 | |
Calculate how many percent of customers were located in India.
|
SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) * 100 / COUNT(T4.customer_id) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id
|
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 how many percent of customers were located in India.
| 9,221 | |
How much percentage of the film did Mary Keitel perform more than Angela Witherspoon?
|
SELECT CAST((SUM(IIF(T1.first_name = 'ANGELA' AND T1.last_name = 'WITHERSPOON', 1, 0)) - SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0))) AS REAL) * 100 / SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0)) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id
|
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 percentage of the film did Mary Keitel perform more than Angela Witherspoon?
| 9,222 | |
Provide the email, address, city, and country of the customer Lillie Kim.
|
SELECT T1.email, T2.address, T3.city, T4.country FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id WHERE T1.first_name = 'Lillie' AND T1.last_name = 'Kim'
|
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 email, address, city, and country of the customer Lillie Kim.
| 9,223 | |
Provide any 5 customers' full names who have rented from Mike Hillyer.
|
SELECT T3.first_name, T3.last_name FROM staff AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.first_name = 'Mike' AND T1.last_name = 'Hillyer' LIMIT 5
|
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 any 5 customers' full names who have rented from Mike Hillyer.
| 9,224 | |
Calculate the total payment amount by Diane Collins.
|
SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'
|
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 payment amount by Diane Collins.
| 9,225 | |
Provide the full names and emails of customers whose payments were greater than 70% of the average.
|
SELECT DISTINCT T2.first_name, T2.last_name, T2.email FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id WHERE T1.amount > ( SELECT AVG(amount) FROM payment ) * 0.7
|
movie_3
|
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 names and emails of customers whose payments were greater than 70% of the average.
| 9,226 | |
How many films have a rental rate of 0.99?
|
SELECT COUNT(film_id) FROM film WHERE rental_rate = 0.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))
#
How many films have a rental rate of 0.99?
| 9,227 | |
Among the customers with customer ID of 100 and below, how many of them have Thomas as their last name?
|
SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100
|
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 customers with customer ID of 100 and below, how many of them have Thomas as their last name?
| 9,228 | |
List the actor's last name that starred the film with the description of "A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies".
|
SELECT T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.description = 'A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies'
|
movie_3
|
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 actor's last name that starred the film with the description of "A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies".
| 9,229 | |
Give the title of the film starred by Liza Bergman with the highest replacement cost.
|
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 = 'Liza' AND T1.last_name = 'Bergman' ORDER BY replacement_cost 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 title of the film starred by Liza Bergman with the highest replacement cost.
| 9,230 | |
Among films with store ID of 2, list the title of films with the highest rental rate.
|
SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1
|
movie_3
|
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 films with store ID of 2, list the title of films with the highest rental rate.
| 9,231 | |
Among the films starred by Angelina Astaire, what is the title of the film with a replacement cost of 27.99?
|
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 = 'Angelina' AND T1.last_name = 'Astaire' AND T3.replacement_cost = 27.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 films starred by Angelina Astaire, what is the title of the film with a replacement cost of 27.99?
| 9,232 | |
List the inventory ID of the film titled "African Egg".
|
SELECT T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.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))
#
List the inventory ID of the film titled "African Egg".
| 9,233 | |
In films with a length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?
|
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'
|
movie_3
|
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 length duration of 113 minutes, how many of the films are starred by Kirk Jovovich?
| 9,234 | |
In the film with an inventory ID between 20 to 60, how many of the films have a G rating?
|
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id BETWEEN 20 AND 60 AND T1.rating = 'G'
|
movie_3
|
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 the film with an inventory ID between 20 to 60, how many of the films have a G rating?
| 9,235 | |
Among films with a rental rate of 4.99, what is the total number of films starred by Bob Fawcett?
|
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rental_rate = 4.99 AND T1.first_name = 'Bob' AND T1.last_name = 'Fawcett'
|
movie_3
|
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 films with a rental rate of 4.99, what is the total number of films starred by Bob Fawcett?
| 9,236 | |
What is the inventory ID of the films starred by Russell Close with a duration between 110 to 150 minutes?
|
SELECT T4.inventory_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 BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.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 is the inventory ID of the films starred by Russell Close with a duration between 110 to 150 minutes?
| 9,237 | |
What is the store and inventory ID of the film with the longest duration?
|
SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1
|
movie_3
|
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 store and inventory ID of the film with the longest duration?
| 9,238 | |
List the titles of the films starred by Elvis Marx.
|
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 T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.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))
#
List the titles of the films starred by Elvis Marx.
| 9,239 | |
In films with rental rate of 4.99, list down the inventory ID of the films starred by Lucille Dee.
|
SELECT T4.inventory_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 T1.first_name = 'Lucille' AND T1.last_name = 'Dee' AND T3.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))
#
In films with rental rate of 4.99, list down the inventory ID of the films starred by Lucille Dee.
| 9,240 | |
List the store ID of the films with a rental rate greater than the 60% of average rental rate of all listed films.
|
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 )
|
movie_3
|
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 with a rental rate greater than the 60% of average rental rate of all listed films.
| 9,241 | |
Among the films starred by Nick Wahlberg, what is the percentage of the films with G rating?
|
SELECT CAST(SUM(IIF(T3.rating = 'G', 1, 0)) AS REAL) / COUNT(T3.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Elvis' AND T1.last_name = 'Marx'
|
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 Nick Wahlberg, what is the percentage of the films with G rating?
| 9,242 | |
List the address in Texas in the ascending order of city id.
|
SELECT address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' )
|
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 address in Texas in the ascending order of city id.
| 9,243 | |
Find the full name and email address of inactive customers whose record was created in 2006.
|
SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND active = 0
|
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))
#
Find the full name and email address of inactive customers whose record was created in 2006.
| 9,244 | |
What percentage of the movies are PG-13?
|
SELECT CAST(SUM(IIF(rating = 'PG-13', 1, 0)) AS REAL) * 100 / COUNT(film_id) 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))
#
What percentage of the movies are PG-13?
| 9,245 | |
Please list the top ten movies with the most price per day in descending order of price per day.
|
SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 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))
#
Please list the top ten movies with the most price per day in descending order of price per day.
| 9,246 | |
Calculate the average rent amount paid by the customer with customer id 15.
|
SELECT AVG(amount) FROM payment WHERE customer_id = 15
|
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 rent amount paid by the customer with customer id 15.
| 9,247 | |
How many customers rented for an above-average period?
|
SELECT COUNT(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental )
|
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 rented for an above-average period?
| 9,248 | |
Among the movies, what percentage are horror?
|
SELECT CAST(SUM(IIF(T2.name = 'horror', 1, 0)) AS REAL) * 100 / COUNT(T2.category_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
|
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 movies, what percentage are horror?
| 9,249 | |
Give the full name of the actor who acted in the most number of movies?
|
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 full name of the actor who acted in the most number of movies?
| 9,250 | |
Give the full name of the actor who acted the most in drama movies?
|
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id WHERE T3.category_id = 7 GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1
|
movie_3
|
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 full name of the actor who acted the most in drama movies?
| 9,251 | |
What is the difference in the average number of films rented each day in Australia and Canada?
|
SELECT AVG(IIF(T4.country = 'Australia', 1, 0)) - AVG(IIF(T4.country = 'Canada', 1, 0)) AS diff FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id
|
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 difference in the average number of films rented each day in Australia and Canada?
| 9,252 | |
Of the movies in which Reese Kilmer acted, what percentage are action movies?
|
SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.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))
#
Of the movies in which Reese Kilmer acted, what percentage are action movies?
| 9,253 | |
Give the total amount of rent for the movie Clockwork Paradice.
|
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_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 T4.title = 'CLOCKWORK PARADICE'
|
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 total amount of rent for the movie Clockwork Paradice.
| 9,254 | |
Find and list the full name of customers who rented more than five types of movies.
|
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id GROUP BY T1.first_name, T1.last_name ) AS T WHERE T.num > 5
|
movie_3
|
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))
#
Find and list the full name of customers who rented more than five types of movies.
| 9,255 | |
What is the average number of actors acted in comedy movies?
|
SELECT AVG(T1.actor_id) FROM film_actor 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 INNER JOIN actor AS T4 ON T4.actor_id = T1.actor_id WHERE T3.name = 'comedy'
|
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 number of actors acted in comedy movies?
| 9,256 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.