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: surname means last_name; Question: How many actors with the surname Kilmer are there?
SELECT COUNT(actor_id) FROM actor WHERE 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: length longer than 100 refers to length > 100 Question: How many movies have a length longer than 100?
SELECT COUNT(film_id) FROM film WHERE length > 100
{'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: payments made refers to amount; throughout the month of August 2005 refers to payment_date like '2005-08%' Question: How many payments were made throughout the month of August 2005?
SELECT SUM(amount) FROM payment WHERE payment_date LIKE '2005-08%'
{'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: To which country does the address '1386 Nakhon Sawan Boulevard' belong?
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id WHERE T3.address = '1386 Nakhon Sawan Boulevard'
{'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: released in 2006 refers to release_year = 2006; the most used language refers to MAX(COUNT(language_id)) Question: What language was the most used in movies released in 2006?
SELECT T.language_id FROM ( SELECT T1.language_id, COUNT(T1.language_id) AS num FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE STRFTIME('%Y',T1.release_year) = '2006' GROUP BY T1.language_id ) 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: 'classics' is the name of category Question: Indicate the title of all the films that are in the Classics category.
SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'
{'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: 'Ella Oliver' is a full name of a customer; full name refers to first_name, last_name; rental hired in June 2016 refers to rental_date BETWEEN '2005-06-01' AND '2005-06-30' Question: How many rentals did Ella Oliver hire in June 2016?
SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'ELLA' AND T2.last_name = 'ELLA' AND date(T1.rental_date) BETWEEN '2005-06-01' AND '2005-06-30'
{'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: 'Jon Stephens' is a full name of a customer; full name refers to first_name, last_name; Question: How many different clients have rented materials from Jon Stephens?
SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'
{'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: July 29, 2005 refers to rental_date like '2005-07-29' Question: What is the total amount paid for rentals made on July 29, 2005?
SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'
{'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: postal code that begins with 76 refers to postal_code like '76%' Question: What is the first name of the customers whose address is in the postal code that begins with 76?
SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'
{'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: 'BLOOD ARGONAUTS' is a title of a film; date a movie was returned refers to return_date Question: On what date was the rented material for the movie BLOOD ARGONAUTS returned?
SELECT T1.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'
{'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: 'Cuba Allen' is a full name of an actor; full name refers to first_name, last_name Question: What is the title of the films in which Cuba Allen acted?
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 = 'Cuba' AND T1.last_name = 'Allen'
{'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: Music' is a name of a category Question: How many actors acted in movies in the Music category?
SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'
{'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; 'comedy' is a name of a category; Question: What is the full name of the actor who has acted the most times in comedy films?
SELECT T.first_name, T.last_name FROM ( SELECT T4.first_name, T4.last_name, COUNT(T2.actor_id) AS num FROM film_category AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN actor AS T4 ON T2.actor_id = T4.actor_id WHERE T3.name = 'Comedy' GROUP BY T4.first_name, T4.last_name ) AS T ORDER BY T.num DESC LIMIT 1
{'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: not at Mike's store refers to staff.first_name ! = 'Mike' Question: How many customers did not rent material at Mike's store?
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id WHERE T3.first_name != 'Mike'
{'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: name refers to first_name, last_name; Parents Strongly Precautioned' refers to rating = 'PG-13'; highest replacement cost refers to MAX(replacement_cost) Question: Indicate the name of the actors of the films rated as 'Parents Strongly Precautioned' with the highest replacement cost.
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'PG-13' ORDER BY T3.replacement_cost DESC LIMIT 1
{'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: name refers to first_name, last_name; without returning a rented material refers to return_date is null Question: What is the name of the client who has the largest quantity of rented material without returning it?
SELECT T.first_name FROM ( SELECT T2.first_name, COUNT(T1.rental_date) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name ) AS T ORDER BY T.num DESC LIMIT 1
{'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 customers live in the city of Miyakonojo?
SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Miyakonojo'
{'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: non-active clients refers to active = 0; not returning a rented material refers to rental_date is null Question: How many non-active clients have not returned the rented material?
SELECT COUNT(T2.customer_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.active = 0
{'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: animated film means animation; animation is a name of a category Question: What is the title of the animated films that have the shortest length?
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 ORDER BY T1.length 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: 'Hector Poinexter' is a full name of a customer; full name refers to first_name, last_name; Question: In which country is the store where Hector Poinexter rents equipment located?
SELECT T5.country FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id INNER JOIN city AS T4 ON T3.city_id = T4.city_id INNER JOIN country AS T5 ON T4.country_id = T5.country_id WHERE T1.first_name = 'HECTOR' AND T1.last_name = 'POINDEXTER'
{'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: 'Horror' is a name of a category; average rental payment refers to AVG(amount) Question: What is the average rental payment in Horror movies?
SELECT AVG(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.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: 'Christy Vargas' is a full name of a customer; full name refers to first_name, last_name; average amount of rent refers to AVG(amount) Question: What is the average amount of rent that Christy Vargas paid?
SELECT AVG(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'CHRISTY' AND T1.Last_name = 'VARGAS'
{'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: Drama' is a name of a category; calculation = DIVIDE(SUM(length < 100 AND name = 'Drama'), COUNT(film_id)) * 100 Question: What percentage of films with a length of less than 100 belong to the Drama category?
SELECT CAST(SUM(IIF(T2.length < 100 AND T3.name = 'Drama', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id
{'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: forename means first_name; full name refers to first_name, last_name Question: What are the actors that have the same forename as Johnny? Please include in your answer the full names of these actors.
SELECT first_name, last_name FROM actor WHERE first_name = 'Johnny'
{'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: address numbers refers to address_id; Question: What are the address numbers that are located in Gansu district?
SELECT address_id FROM address WHERE district = 'Gansu'
{'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: types of film refers to the name of a category; IDs refers to category_id; latest update refers to last_update. Question: Please list three types of film along with their IDs and the latest update.
SELECT DISTINCT name, category_id, last_update FROM category LIMIT 3
{'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; inactive customers refers to active = 0 Question: Please list the full names of any three inactive customers.
SELECT first_name, last_name FROM customer WHERE active = 0 LIMIT 3
{'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: rental price per day refers to DIVIDE(rental_price, rental_duration); 'Airplane Sierra' is a title of a film Question: What is the rental price per day for Airplane Sierra?
SELECT rental_rate / rental_duration AS result FROM film WHERE title = 'AIRPLANE SIERRA'
{'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: store number 2 refers to store_id = 2; where is a store located refers to address, address2, district Question: Where is store number 2 located?
SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2
{'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 city does the address 1623 Kingstown Drive belong to?
SELECT T1.city FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id WHERE T2.address = '1623 Kingstown Drive'
{'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: Algeria is a country Question: Please name three cities that belong to Algeria.
SELECT T2.city FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'Algeria'
{'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: 'Agent Truman' is a title of a film; category refers to name Question: What is the category of the film Agent Truman?
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 = 'AGENT TRUMAN'
{'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 is a name of category Question: Please list the titles of any three action films.
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 = 'Action' LIMIT 3
{'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: 'children' AND 'action' are names of a category; Calculation = SUBTRACT(AVG('children'), AVG('action')) Question: What is the difference between the number of children's films and action films?
SELECT SUM(IIF(T2.name = 'Children', 1, 0)) - SUM(IIF(T2.name = 'Action', 1, 0)) AS diff FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
{'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: 'Maria Miller' is a name of a customer; full name refers to first_name, last_name Question: Which district does Maria Miller live in?
SELECT T2.district FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_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: active refers to active = 1; '1795 Santiago de Compostela Way' is an address; Texas is a district; who refers to first_name, last_name Question: Who is the customer that is active and lives at 1795 Santiago de Compostela Way, Texas?
SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T2.address = '1795 Santiago de Compostela Way' AND T1.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: English is a name of a language; duration of over 50 minutes refers to length > 50; cost of replacement are under 10.99 refers to replacement_cost < 10.99 Question: How many English films have a duration of over 50 minutes and the cost of replacement are under 10.99?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.length > 50 AND T1.replacement_cost < 10.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: Who are the actors refers to full name; full name refers to first_name, last_name; 'ACADEMY DINOSAUR' is a title of a film Question: Who are the actors that act in the ACADEMY DINOSAUR film?
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 = 'ACADEMY DINOSAUR'
{'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 of the film; 'Penelope Guiness' is a full name of an actor; full name refers to first_name, last_name Question: Please list any two films that Penelope Guiness acted in.
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Penelope' AND T1.last_name = 'Guiness' LIMIT 2
{'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' is a name of a category; calculation = DIVIDE(SUM(name = 'Documentary'), COUNT(film_id)) * 100 Question: What is the percentage of documentary films?
SELECT CAST(SUM(IIF(T2.name = 'Documentary', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id
{'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: English is a name of a language; for adults only refers to rating = 'NC-17' Question: How many films in English are for adults only?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English' AND T1.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: film refers to the title; the longest duration refers to MAX(length) Question: Which film has the longest duration?
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: 'Dan' is a first_name of an actor Question: How many of the actors are named "Dan"?
SELECT COUNT(actor_id) FROM actor WHERE first_name = 'Dan'
{'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 most common first name refers to MAX(COUNT(first_name)) Question: What is the most common first name among the customers?
SELECT first_name FROM customer GROUP BY first_name ORDER BY COUNT(first_name) 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: film featuring behind the scenes refers to special_features = 'Behind the Scenes' Question: What are the ratings of the film featuring behind the scenes?
SELECT rating FROM film WHERE special_features LIKE '%Behind the Scenes%'
{'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 largest number of films refers to MAX(rental_id) Question: What is the largest number of films rented per customer?
SELECT COUNT(rental_id) FROM rental GROUP BY customer_id ORDER BY COUNT(rental_id) 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: films refers to title Question: List all the films with the word "Lacklusture" in their description.
SELECT title FROM film_text WHERE description LIKE '%Lacklusture%'
{'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: 'Francis Sikes' is a full name of a customer; full name refers to first_name, last_name; Question: How many films did a customer named Francis Sikes rent?
SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'FRANCIS' AND T1.last_name = 'SIKES'
{'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: Who refers to first_name, last_name; the largest collection of films refers to MAX(film_id) Question: Who is the manager of the store with the largest collection of films?
SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.film_id) AS num FROM inventory AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id GROUP BY T3.first_name, T3.last_name ) 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: inactive customers refers to active = 0; Question: What are the addresses of the inactive customers?
SELECT T2.address FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.active = 0
{'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: most common category refers to MAX(COUNT(category.name)) Question: Which category is the most common?
SELECT T.name FROM ( SELECT T2.name, COUNT(T2.name) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1
{'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: 'Jason trap' is a title of a film; cast means actor; actor refers to first_name, last_name Question: Provide the cast for the film "Jason trap".
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 = 'JASON TRAP'
{'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: Who refers to first_name, last_name; the largest payment for rental refers to MAX(SUM(amount)) Question: Who is the customer with the largest payment for rental films?
SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, SUM(T2.amount) AS num FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ) 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: film refers to title; most rented refers to MAX(inventory_id) Question: List the top 5 most-rented films.
SELECT T.title FROM ( SELECT T3.title, COUNT(T2.inventory_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 5
{'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: 'Sasebo' is a city Question: Which country does Sasebo belong to?
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Sasebo'
{'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 addresses for the stores?
SELECT T2.address FROM store AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id
{'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: 'animation' is a name of a category Question: List all the animation titles.
SELECT T3.title AS per FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Animation'
{'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 most customers refers to MAX(COUNT(customer_id)) Question: What is the city with the most customers?
SELECT T.city FROM ( SELECT T1.city, COUNT(T3.customer_id) AS num FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id GROUP BY T1.city ) 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: actor refers to first_name, last_name; the most film refers to MAX(SUM(film_id)) Question: Which actor acted in the most films?
SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, SUM(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1
{'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: horror' is a name of a category; calculation = DIVIDE(SUM(name = 'Horror'), COUNT(film_id)) * 100 Question: What percentage of films are horror films?
SELECT CAST(SUM(IIF(T2.name = 'Horror', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id
{'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: Please indicate the full name of actor id 5.
SELECT first_name, last_name FROM actor WHERE actor_id = 5
{'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: id movies refers to film_id Question: How many id movies have category id 11?
SELECT COUNT(film_id) FROM film_category WHERE category_id = 11
{'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; BABY HALL film refers to title = 'BABY HALL' Question: Which category does BABY HALL film belong to?
SELECT T3.`name` FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T1.title = 'BABY HALL'
{'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 highest rental rate refers to max(rental_rate) Question: Give the full name of the actor with the highest rental rate.
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 T3.film_id = T2.film_id 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: Please give the description of the movie starring JENNIFER DAVIS.
SELECT T3.description FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T3.film_id = T2.film_id WHERE T1.first_name = 'JOHNNY' AND T1.last_name = 'DAVIS'
{'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; more than 10$ refers to amount > 10 Question: List the full names of customers who have paid more than 10$.
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: Question: Please provide the address of the customer whose first name is SUSAN with the postal code 77948.
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'SUSAN' AND T1.postal_code = 77948
{'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: name refers to first_name, last_name Question: How many customers have an address in Abu Dhabi city? List those customer names.
SELECT COUNT(T1.city_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Abu Dhabi'
{'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; 692 Joliet Street refers to address = '692 Joliet Street' Question: Please provide the full name of the customer at 692 Joliet Street.
SELECT T2.first_name, T2.last_name FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T1.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: duration over 120 minutes refers to length > 120; action category refers to category.name = 'action' Question: List movie titles with duration over 120 minutes that are in the action 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 T3.category_id = T2.category_id WHERE T3.`name` = 'action' AND T1.length > 120
{'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; ANONYMOUS HUMAN refers to title = 'ANONYMOUS HUMAN' Question: Which actor acted in ANONYMOUS HUMAN?
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 T3.film_id = T2.film_id WHERE T3.title = 'ANONYMOUS HUMAN'
{'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 lowest movie rental refers to min(rental_rate); the horror category refers to category.name = 'Horror' Question: Which movie title has the lowest movie rental in 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' ORDER BY T1.rental_rate 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 category Travel refers to category.name = 'Travel' Question: List the descriptions of movies under the category Travel.
SELECT T1.description 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` = 'Travel'
{'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 payment amount refers to sum(amount) Question: Calculate the total payment amount of customers in Nagasaki district.
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T3.address_id = T2.address_id WHERE T3.district = 'Nagasaki'
{'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: percentage = divide(sum(amount where first_name = 'MARGARET' and last_name = 'MOORE'), sum(amount)) * 100% Question: Calculate the percentage of total payment of MARGARET MOORE customers.
SELECT CAST(SUM(IIF(T2.first_name = 'MARGARET' AND T2.last_name = 'MOORE', T1.amount, 0)) AS REAL) * 100 / SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id
{'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: screen length of more than 120 minutes refers to length > 120; category of horror refers to category.name = 'Horror'; percentage = divide(count(title where length > 120 and category.name = 'Horror'), count(title)) * 100% Question: Calculate the percentage of movie titles with a screen length of more than 120 minutes that have a category of horror movies.
SELECT CAST(SUM(IIF(T3.`name` = 'Horror', 1, 0)) * 100 / COUNT(T1.film_id) AS REAL) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T1.length > 120
{'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: released in 2006 refers to release_year = 2006 Question: How many film titles were released in 2006?
SELECT COUNT(film_id) FROM film WHERE release_year = 2006
{'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: id 1 to 10 refers to film_id BETWEEN 1 and 10 Question: List down film titles from id 1 to 10.
SELECT title FROM film WHERE film_id BETWEEN 1 AND 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: highest rental duration refers to max(rental_duration) Question: List down all of the film IDs with highest rental duration.
SELECT film_id FROM film WHERE rental_duration = ( SELECT MAX(rental_duration) 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: the most expensive rental rate refers to max(rental_rate) Question: Which film titles have the most expensive rental rate?
SELECT title FROM film WHERE rental_rate = ( SELECT MAX(rental_rate) 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: rated for general audiences means rating = 'G' Question: List down all of the film titles that are rated for general audiences.
SELECT title FROM film WHERE rating = 'G'
{'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 language for film titled "CHILL LUCK"?
SELECT T2.`name` FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'CHILL LUCK'
{'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 last updated date refers to last_update; English is name of language; released in 2006 refers to release_year = 2006 Question: What are the last updated date for English film titles that were released in 2006?
SELECT DISTINCT T1.last_update FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T2.`name` = 'English' AND T1.release_year = 2006
{'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: Italian is name of language; special featured with deleted scenes refers to special_features = 'deleted scenes' Question: How many Italian film titles were special featured with deleted scenes?
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T2.`name` = 'Italian' AND T1.special_features = 'deleted scenes'
{'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: animation film refers to category.name = 'animation'; for adults only means rating = 'NC-17' Question: How many animation film titles are rated for adults only?
SELECT COUNT(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 = 'animation' AND T1.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: for General Audiences means rating = 'G'; Parental Guidance Suggested means rating = 'PG'; Parents Strongly Cautioned means rating = 'PG-13'; Restricted means rating = 'R'; Adults Only means rating = 'NC-17'; action film refers to category.name = 'action' Question: List down all ratings of action film titles.
SELECT T1.description 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 = '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: comedy is name of category Question: List down all film IDs of comedy film titles.
SELECT 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 T3.category_id = T2.category_id WHERE T3.name = 'comedy'
{'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 name = 'documentary'; longest length refers to max(length) Question: State the documentary film titles with longest length.
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 T3.category_id = T2.category_id WHERE T3.name = 'documentary' ORDER BY T1.length 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 is the category of film titled "BLADE POLISH"?
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 T3.category_id = T2.category_id WHERE T1.title = 'BLADE POLISH'
{'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 Mary Smith's rental ID?
SELECT T2.rental_id FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'MARY' AND T1.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: Question: List down all of the customers' first name who were attended by staff with ID 1.
SELECT DISTINCT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.staff_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: email address refers to email Question: List down email address of customers who were attended by staff with ID 2.
SELECT DISTINCT T1.email FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T2.staff_id = 2
{'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 IDs of film titled "BOUND CHEAPER".
SELECT T2.actor_id FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id WHERE T1.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: Question: What is the inventory ID of Karen Jackson?
SELECT T2.inventory_id FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'KAREN' AND T1.last_name = 'JACKSON'
{'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 all film titles starred by Jane Jackman.
SELECT T1.title FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T2.actor_id = T3.actor_id WHERE T3.first_name = 'JANE' AND T3.last_name = 'JACKMAN'
{'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 Question: Who are the actors of film titled "BIRD INDEPENDENCE"?
SELECT T3.first_name, T3.last_name FROM film AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T2.actor_id = T3.actor_id WHERE T1.title = 'BIRD INDEPENDENCE'
{'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: animation film refers to category.name = 'Animation'; total rental rate = sum(rental_rate) Question: Calculate the total rental rate for animation film titles.
SELECT SUM(T1.rental_rate) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.`name` = 'Animation'
{'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: sci-fi film refers to category.name = 'Sci-Fi'; average rental rate = avg(rental_rate) Question: What is the average rental rate of sci-fi film titles?
SELECT AVG(T1.rental_rate) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T3.category_id = T2.category_id WHERE T3.`name` = 'Sci-Fi'
{'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: horror film refers to category.name = 'Horror'; English film refers to language.name = 'English'; percentage = divide(count(film_id where category.name = 'Horror'), count(film_id)) where language.name = 'English' * 100% Question: What is the percentage of horror film titles in English film titles?
SELECT CAST(SUM(IIF(T3.name = 'Horror', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN language AS T4 ON T2.language_id = T4.language_id WHERE T4.name = 'English'
{'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