question
stringlengths
326
2.82k
answer
stringlengths
23
804
db_schema
stringclasses
67 values
db_name
stringclasses
67 values
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: adult film refers to rating = 'NC-17'; rental duration of fewer than 4 days refers to rental_duration < 4 Question: Among the adult films, how many of them have a rental duration of fewer than 4 days?
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND rental_duration < 4
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: restricted means rating = 'R'; length is 71 minutes refers to length = 71; replacement cost is $29.99 refers to replacement_cost = 29.99 Question: What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99?
SELECT title FROM film WHERE replacement_cost = 29.99 AND rating = 'R' AND length = 71
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: email address refers to email; active refers to active = 1; between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM refers to rental_date between '2005-5-25 07:37:47' and '2005-5-26 10:06:49' Question: Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM.
SELECT T2.email FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.rental_date BETWEEN '2005-5-25 07:37:47' AND '2005-5-26 10:06:49' AND T2.active = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: total payment = sum(amount) Question: Compute the total payment made by Sarah Lewis for film rentals so far.
SELECT SUM(T3.amount) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN payment AS T3 ON T1.rental_id = T3.rental_id WHERE T2.first_name = 'SARAH' AND T2.last_name = 'LEWIS'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: from 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM refers to payment_date between '2005-05-30 03:43:54' and '2005-07-31 10:08:29' Question: From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_date BETWEEN '2005-05-30 03:43:54' AND '2005-07-31 10:08:29'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; "Alabama Devil" refers to title = 'ALABAMA DEVIL' Question: Tally the full names of actors in the film "Alabama Devil."
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ALABAMA DEVIL'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Tell me the title of the film in which Sandra Kilmer is one of the actors.
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'SANDRA' AND T2.last_name = 'KILMER'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: documentary film refers to category.name = 'documentary'; rated PG-13 refers to rating = 'PG-13' Question: How many documentary films are rated PG-13?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' AND T1.rating = 'PG-13'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: category name refers to category.name; price per day is more than $30 refers to multiply(rental_duration, rental_rate) > 30 Question: Give me the title and category name of films whose price per day is more than $30. Please include their special features.
SELECT T1.title, T3.name, T1.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration * T1.rental_rate > 30
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: cast member name refers to first_name, last_name; 'African Egg' refers to title = 'AFRICAN EGG' Question: Name the cast members of the movie 'African Egg'.
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'AFRICAN EGG'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Identify the number of movies rented by Maria Miller.
SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: movie name refers to title; the most recent refers to max(rental_date) Question: Name the most recent movie rented by Dorothy Taylor.
SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'DOROTHY' AND T1.last_name = 'TAYLOR' ORDER BY T2.rental_date DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: action movie refers to category.name = 'Action' Question: Determine the number of action movies available for rent.
SELECT COUNT(T2.film_id) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id WHERE T1.name = 'Action'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: 'Wyoming Storm' refers to title = 'WYOMING STORM' Question: Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate.
SELECT T2.store_id, T1.address, T4.rental_rate FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id INNER JOIN inventory AS T3 ON T2.store_id = T3.store_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'WYOMING STORM'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: 'Destiny Saturday' refers to title = 'DESTINY SATURDAY'; length = subtract(return_date, rental_date) Question: How long did Austin Cintron take to return the movie 'Destiny Saturday'?
SELECT T2.rental_date - T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'AUSTIN' AND T4.title = 'DESTINY SATURDAY'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Identify the number of movies that starred Nick Stallone.
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id AND T2.first_name = 'NICK' AND T2.last_name = 'STALLONE'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: movie name refers to title; the highest rental revenue refers to max(multiply(rental_duration, rental_rate)); the shortest film refers to min(length) Question: Name the movie with the highest rental revenue among the shortest films.
SELECT title FROM film WHERE length = ( SELECT MIN(length) FROM film ) ORDER BY rental_duration * rental_rate DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: the total amount = sum(amount); in June 2005 refers to payment_date like '2005-06%' Question: Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005.
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'STEPHANIE' AND T2.last_name = 'MITCHELL' AND SUBSTR(T1.payment_date, 1, 7) = '2005-06'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: a rental rate of 4.99 refers to rental_rate = 4.99; average replacement cost = avg(replacement_cost) Question: What is the average replacement cost for the movies with a rental rate of 4.99?
SELECT AVG(replacement_cost) FROM film WHERE rental_rate = 4.99
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: PG-13 rated movie refers to rating = 'PG-13'; average rental rate = avg(rental_rate) Question: What is the average rental rate for PG-13 rated movies?
SELECT AVG(rental_rate) FROM film WHERE rating = 'PG-13'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: inactive refers to active = 0; store no.1 refers to store_id = 1; percentage = divide(count(customer_id where active = 0), count(customer_id)) * 100% where store_id = 1 Question: Indicate the percentage of inactive customers at store no.1.
SELECT CAST(SUM(CASE WHEN active = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(customer_id) FROM customer WHERE store_id = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: length refers to rental_duration; 'Dirty Ace' refers to title = 'DIRTY ACE' Question: For how long can you rent the movie 'Dirty Ace'?
SELECT rental_duration FROM film WHERE title = 'DIRTY ACE'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name Question: Identify the full name of the customer, who has the following email address: SHEILA.WELLS@sakilacustomer.org.
SELECT first_name, last_name FROM customer WHERE email = 'SHEILA.WELLS@sakilacustomer.org'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: the longest refers to max(length) Question: Provide the list of the longest movies. Arrange these titles in alphabetical order.
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film )
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: How many film categories are there?
SELECT COUNT(DISTINCT category_id) FROM category
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: in June 2005 refers to month(rental_date) = 6 and year(rental_date) = 2005; percentage = divide(count(inventory_id where month(rental_date) = 6 and year(rental_date) = 2005), count(inventory_id)) * 100% Question: How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005.
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: active refers to active = 1 Question: How many customers are still active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; rated as PG-13 refers to rating = 'PG-13' Question: List all the films that are rated as PG-13.
SELECT title FROM film WHERE rating = 'PG-13'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; rent for more than 5 days refers to rental_duration > 5 Question: List at least 10 films that the customers can rent for more than 5 days.
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: United Arab Emirates refers to country = 'United Arab Emirates' Question: List all the cities that belong to United Arab Emirates.
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'United Arab Emirates'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; greater than $10 refers to amount > 10 Question: List at least 5 customers who paid greater than $10. Provide the full name of the customers.
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.amount > 10
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title Question: What films did Burt Dukakis got star in?
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'BURT' AND T2.last_name = 'DUKAKIS'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; film "Ending Crowds" refers to title = 'ENDING CROWDS' Question: Provide the full name of all the actors of the film "Ending Crowds".
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ENDING CROWDS'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: actor refers to first_name, last_name; film "Bound Cheaper" refers to title = 'BOUND CHEAPER' Question: Who are the actors starred in the film "Bound Cheaper"?
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BOUND CHEAPER'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; rated as PG refers to rating = 'PG' Question: List all the films that Karl Berr starred in and rated as PG.
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'KARL' AND T1.last_name = 'BERRY' AND T3.rating = 'PG'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: List at least 3 cities under the country of Philippines.
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'Philippines'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; least rented refers to count(min(customer_id)) Question: What are the films that are least rented by the customers?
SELECT T.title FROM ( SELECT T3.title, COUNT(T1.customer_id) AS num FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T3.title ) AS T ORDER BY T.num DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: List all the description of the films starring Lucille Tracy?
SELECT T1.film_id FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'LUCILLE' AND T2.last_name = 'TRACY'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: category refers to name; film "Beach Heartbreakers" refers to title = 'BEACH HEARTBREAKERS' Question: Which category is the film "Beach Heartbreakers" falls into?
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'BEACH HEARTBREAKERS'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; Horror category refers to category.name = 'Horror' Question: List at least 10 films that falls into the Horror category.
SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: NC-17 rated refers to rating = 'NC-17' Question: Who among the actors starred in a NC-17 rated film? Provide only the last name of the actors.
SELECT T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'NC-17'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: average rate = divide(sum(rental_rate), count(film_id)) Question: Calculate the average rate of renting the film that Lucille Tracy got starred.
SELECT AVG(T3.rental_rate) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'LUCILLE' AND T1.last_name = 'TRACY'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: duration between 100 to 110 minutes refers to length between 100 and 110 Question: How many films have a duration between 100 to 110 minutes?
SELECT COUNT(film_id) FROM film WHERE length BETWEEN 100 AND 110
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: List down the actor ID of actors with Dee as their last name.
SELECT actor_id FROM actor WHERE last_name = 'Dee'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: active refers to active = 1 Question: Among the active customers, how many of them have Nina as their first name?
SELECT COUNT(customer_id) FROM customer WHERE first_name = 'Nina' AND active = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: R rating refers to rating = 'R' Question: In store ID 2, how many of the films are R rating?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 AND T1.rating = 'R'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: a duration of 100 minutes and below refers to length < 100 Question: List the store ID of the films starred by Reese West with a duration of 100 minutes and below?
SELECT T4.store_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length < 100 AND T1.first_name = 'Reese' AND T1.last_name = 'West'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: duration refers to length; the highest rental rate refers to max(rental_rate) Question: Give the duration of the film starred by Nick Wahlberg with the highest rental rate.
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Nick' AND T1.last_name = 'Wahlberg' ORDER BY T3.rental_rate DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: What are the titles of the films starred by Russell Close?
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'Russell' AND T2.last_name = 'Close'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: List the store ID of the film titled "Amadeus Holy".
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'Amadeus Holy'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: a rental rate of 2.99 refers to rental_rate = 2.99 Question: In films with a rental rate of 2.99, how many of the films are starred by Nina Soto?
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate = 2.99 AND T2.first_name = 'Nina' AND T2.last_name = 'Soto'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: result = subtract(count(film_id where store_id = 1), count(film_id where store_id = 2)) Question: Among the films starred by Reese West, what is the difference between the films that have store ID of 1 and store ID of 2?
SELECT SUM(IIF(T4.film_id = 1, 1, 0)) - SUM(IIF(T4.film_id = 2, 1, 0)) AS diff FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T2.first_name = 'Reese' AND T2.last_name = 'West'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: What is the postal code of the address 692 Joliet Street?
SELECT postal_code FROM address WHERE address = '692 Joliet Street'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: active refers to active = 1 Question: How many customers are active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: active refers to active = 1 Question: Among all the customers of store no.1, how many of them are active?
SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND store_id = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: What is the address of Mary Smith?
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: active refers to active = 1; Arlington refers to city = 'Arlington' Question: Among all the active customers, how many of them live in Arlington?
SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; Italy refers to country = 'Italy' Question: Please list the full names of all the customers who live in Italy.
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Which country does Mary Smith live in?
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: the biggest amount refers to max(amount) Question: What is the biggest amount of payment for a rental made by Mary Smith?
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: How many times has Mary Smith rented a film?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: the total amount = sum(amount) Question: What is the total amount of money Mary Smith has spent on film rentals?
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: in June 2005 refers to year(payment_date) = 2005 and month(payment_date) = 6 Question: Among the times Mary Smith had rented a movie, how many of them happened in June, 2005?
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; the biggest amount refers to max(amount) Question: Please give the full name of the customer who had made the biggest amount of payment in one single film rental.
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: total = sum(amount); Italy refers to country = 'Italy' Question: How much in total had the customers in Italy spent on film rentals?
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: over 4.99 refers to amount > 4.99 Question: Among the payments made by Mary Smith, how many of them are over 4.99?
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Italy refers to country = 'Italy'; average amount = divide(sum(amount), count(customer_id)) where country = 'Italy' Question: What is the average amount of money spent by a customer in Italy on a single film rental?
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3