input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Please list any two films that Penelope Guiness acted in. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the percentage of documentary films? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many films in English are for adults only? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which film has the longest duration? [/INST]
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film );
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many of the actors are named "Dan"? [/INST]
SELECT COUNT(actor_id) FROM actor WHERE first_name = 'Dan';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the most common first name among the customers? [/INST]
SELECT first_name FROM customer GROUP BY first_name ORDER BY COUNT(first_name) DESC LIMIT 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What are the ratings of the film featuring behind the scenes? [/INST]
SELECT rating FROM film WHERE special_features LIKE '%Behind the Scenes%';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the largest number of films rented per customer? [/INST]
SELECT COUNT(rental_id) FROM rental GROUP BY customer_id ORDER BY COUNT(rental_id) DESC LIMIT 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the films with the word "Lacklusture" in their description. [/INST]
SELECT title FROM film_text WHERE description LIKE '%Lacklusture%';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many films did a customer named Francis Sikes rent? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Who is the manager of the store with the largest collection of films? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What are the addresses of the inactive customers? [/INST]
SELECT T2.address FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.active = 0;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which category is the most common? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Provide the cast for the film "Jason trap". [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Who is the customer with the largest payment for rental films? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List the top 5 most-rented films. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which country does Sasebo belong to? [/INST]
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Sasebo';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What are the addresses for the stores? [/INST]
SELECT T2.address FROM store AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the animation titles. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the city with the most customers? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which actor acted in the most films? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What percentage of films are horror films? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Please indicate the full name of actor id 5. [/INST]
SELECT first_name, last_name FROM actor WHERE actor_id = 5;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many id movies have category id 11? [/INST]
SELECT COUNT(film_id) FROM film_category WHERE category_id = 11;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which category does BABY HALL film belong to? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Give the full name of the actor with the highest rental rate. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Please give the description of the movie starring JENNIFER DAVIS. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List the full names of customers who have paid more than 10$. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Please provide the address of the customer whose first name is SUSAN with the postal code 77948. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many customers have an address in Abu Dhabi city? List those customer names. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Please provide the full name of the customer at 692 Joliet Street. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List movie titles with duration over 120 minutes that are in the action category. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which actor acted in ANONYMOUS HUMAN? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which movie title has the lowest movie rental in the horror category? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List the descriptions of movies under the category Travel. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Calculate the total payment amount of customers in Nagasaki district. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Calculate the percentage of total payment of MARGARET MOORE customers. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Calculate the percentage of movie titles with a screen length of more than 120 minutes that have a category of horror movies. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many film titles were released in 2006? [/INST]
SELECT COUNT(film_id) FROM film WHERE release_year = 2006;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down film titles from id 1 to 10. [/INST]
SELECT title FROM film WHERE film_id BETWEEN 1 AND 10;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all of the film IDs with highest rental duration. [/INST]
SELECT film_id FROM film WHERE rental_duration = ( SELECT MAX(rental_duration) FROM film );
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which film titles have the most expensive rental rate? [/INST]
SELECT title FROM film WHERE rental_rate = ( SELECT MAX(rental_rate) FROM film );
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all of the film titles that are rated for general audiences. [/INST]
SELECT title FROM film WHERE rating = 'G';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the language for film titled "CHILL LUCK"? [/INST]
SELECT T2.`name` FROM film AS T1 INNER JOIN `language` AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'CHILL LUCK';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What are the last updated date for English film titles that were released in 2006? [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many Italian film titles were special featured with deleted scenes? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many animation film titles are rated for adults only? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all ratings of action film titles. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all film IDs of comedy film titles. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: State the documentary film titles with longest length. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the category of film titled "BLADE POLISH"? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is Mary Smith's rental ID? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all of the customers' first name who were attended by staff with ID 1. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down email address of customers who were attended by staff with ID 2. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down the actor IDs of film titled "BOUND CHEAPER". [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the inventory ID of Karen Jackson? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List down all film titles starred by Jane Jackman. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Who are the actors of film titled "BIRD INDEPENDENCE"? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Calculate the total rental rate for animation film titles. [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the average rental rate of sci-fi film titles? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the percentage of horror film titles in English film titles? [/INST]
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';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Among the adult films, how many of them have a rental duration of fewer than 4 days? [/INST]
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND rental_duration < 4;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the title of the restricted film, whose length is 71 minutes and whose replacement cost is $29.99? [/INST]
SELECT title FROM film WHERE replacement_cost = 29.99 AND rating = 'R' AND length = 71;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Write down the email addresses of active customers who rented between 5/25/2005 at 7:37:47 PM and 5/26/2005 at 10:06:49 AM. [/INST]
SELECT T2.email FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.rental_date BETWEEN '2005-5-25 07:37:47' AND '2005-5-26 10:06:49' AND T2.active = 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Compute the total payment made by Sarah Lewis for film rentals so far. [/INST]
SELECT SUM(T3.amount) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN payment AS T3 ON T1.rental_id = T3.rental_id WHERE T2.first_name = 'SARAH' AND T2.last_name = 'LEWIS';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: From 5/30/2005 at 3:43:54 AM to 7/31/2005 at 10:08:29 PM, how many times did Susan Wilson pay for film rentals? [/INST]
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T1.payment_date BETWEEN '2005-05-30 03:43:54' AND '2005-07-31 10:08:29';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Tally the full names of actors in the film "Alabama Devil." [/INST]
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ALABAMA DEVIL';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Tell me the title of the film in which Sandra Kilmer is one of the actors. [/INST]
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'SANDRA' AND T2.last_name = 'KILMER';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many documentary films are rated PG-13? [/INST]
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Documentary' AND T1.rating = 'PG-13';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Give me the title and category name of films whose price per day is more than $30. Please include their special features. [/INST]
SELECT T1.title, T3.name, T1.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration * T1.rental_rate > 30;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Name the cast members of the movie 'African Egg'. [/INST]
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'AFRICAN EGG';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Identify the number of movies rented by Maria Miller. [/INST]
SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Name the most recent movie rented by Dorothy Taylor. [/INST]
SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'DOROTHY' AND T1.last_name = 'TAYLOR' ORDER BY T2.rental_date DESC LIMIT 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Determine the number of action movies available for rent. [/INST]
SELECT COUNT(T2.film_id) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id WHERE T1.name = 'Action';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Where can you rent the movie 'Wyoming Storm'? Identify the address of the rental store and the rental rate. [/INST]
SELECT T2.store_id, T1.address, T4.rental_rate FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id INNER JOIN inventory AS T3 ON T2.store_id = T3.store_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'WYOMING STORM';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How long did Austin Cintron take to return the movie 'Destiny Saturday'? [/INST]
SELECT T2.rental_date - T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'AUSTIN' AND T4.title = 'DESTINY SATURDAY';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Identify the number of movies that starred Nick Stallone. [/INST]
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id AND T2.first_name = 'NICK' AND T2.last_name = 'STALLONE';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Name the movie with the highest rental revenue among the shortest films. [/INST]
SELECT title FROM film WHERE length = ( SELECT MIN(length) FROM film ) ORDER BY rental_duration * rental_rate DESC LIMIT 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Calculate the total amount paid by Stephanie Mitchell for film rentals in June 2005. [/INST]
SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'STEPHANIE' AND T2.last_name = 'MITCHELL' AND SUBSTR(T1.payment_date, 1, 7) = '2005-06';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the average replacement cost for the movies with a rental rate of 4.99? [/INST]
SELECT AVG(replacement_cost) FROM film WHERE rental_rate = 4.99;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What is the average rental rate for PG-13 rated movies? [/INST]
SELECT AVG(rental_rate) FROM film WHERE rating = 'PG-13';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Indicate the percentage of inactive customers at store no.1. [/INST]
SELECT CAST(SUM(CASE WHEN active = 0 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(customer_id) FROM customer WHERE store_id = 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: For how long can you rent the movie 'Dirty Ace'? [/INST]
SELECT rental_duration FROM film WHERE title = 'DIRTY ACE';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Identify the full name of the customer, who has the following email address: [email protected]. [/INST]
SELECT first_name, last_name FROM customer WHERE email = '[email protected]';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Provide the list of the longest movies. Arrange these titles in alphabetical order. [/INST]
SELECT title FROM film WHERE length = ( SELECT MAX(length) FROM film );
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many film categories are there? [/INST]
SELECT COUNT(DISTINCT category_id) FROM category;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many titles did Mary Smith rent in 2005? Determine the percentage of titles rented in June 2005. [/INST]
SELECT COUNT(T2.rental_id) , CAST(SUM(IIF(STRFTIME('%m',T2.rental_date) = '7', 1, 0)) AS REAL) * 100 / COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller' AND STRFTIME('%Y',T2.rental_date) = '2005';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: How many customers are still active? [/INST]
SELECT COUNT(customer_id) FROM customer WHERE active = 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the films that are rated as PG-13. [/INST]
SELECT title FROM film WHERE rating = 'PG-13';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List at least 10 films that the customers can rent for more than 5 days. [/INST]
SELECT T.title FROM ( SELECT T1.title, COUNT(T3.customer_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.rental_duration > 5 GROUP BY T1.title ) AS T WHERE T.num > 10;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the cities that belong to United Arab Emirates. [/INST]
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'United Arab Emirates';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List at least 5 customers who paid greater than $10. Provide the full name of the customers. [/INST]
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;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What films did Burt Dukakis got star in? [/INST]
SELECT T3.title FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.first_name = 'BURT' AND T2.last_name = 'DUKAKIS';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Provide the full name of all the actors of the film "Ending Crowds". [/INST]
SELECT T2.first_name, T2.last_name FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.title = 'ENDING CROWDS';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Who are the actors starred in the film "Bound Cheaper"? [/INST]
SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BOUND CHEAPER';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the films that Karl Berr starred in and rated as PG. [/INST]
SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'KARL' AND T1.last_name = 'BERRY' AND T3.rating = 'PG';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List at least 3 cities under the country of Philippines. [/INST]
SELECT T1.city FROM city AS T1 INNER JOIN country AS T2 ON T2.country_id = T1.country_id WHERE country = 'Philippines';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: What are the films that are least rented by the customers? [/INST]
SELECT T.title FROM ( SELECT T3.title, COUNT(T1.customer_id) AS num FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T3.title ) AS T ORDER BY T.num DESC LIMIT 1;
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: List all the description of the films starring Lucille Tracy? [/INST]
SELECT T1.film_id FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'LUCILLE' AND T2.last_name = 'TRACY';
[INST] Here is a database schema: film_text : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] actor : actor_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] last_update [ DATETIME ] address : address_id [ INTEGER ] primary_key address [ TEXT ] address2 [ TEXT ] district [ TEXT ] city_id [ INTEGER ] postal_code [ TEXT ] phone [ TEXT ] last_update [ DATETIME ] category : category_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] city : city_id [ INTEGER ] primary_key city [ TEXT ] country_id [ INTEGER ] last_update [ DATETIME ] country : country_id [ INTEGER ] primary_key country [ TEXT ] last_update [ DATETIME ] customer : customer_id [ INTEGER ] primary_key store_id [ INTEGER ] first_name [ TEXT ] last_name [ TEXT ] email [ TEXT ] address_id [ INTEGER ] active [ INTEGER ] create_date [ DATETIME ] last_update [ DATETIME ] film : film_id [ INTEGER ] primary_key title [ TEXT ] description [ TEXT ] release_year [ TEXT ] language_id [ INTEGER ] original_language_id [ INTEGER ] rental_duration [ INTEGER ] rental_rate [ REAL ] length [ INTEGER ] replacement_cost [ REAL ] rating [ TEXT ] special_features [ TEXT ] last_update [ DATETIME ] film_actor : actor_id [ INTEGER ] film_id [ INTEGER ] last_update [ DATETIME ] film_category : film_id [ INTEGER ] category_id [ INTEGER ] last_update [ DATETIME ] inventory : inventory_id [ INTEGER ] primary_key film_id [ INTEGER ] store_id [ INTEGER ] last_update [ DATETIME ] language : language_id [ INTEGER ] primary_key name [ TEXT ] last_update [ DATETIME ] payment : payment_id [ INTEGER ] primary_key customer_id [ INTEGER ] staff_id [ INTEGER ] rental_id [ INTEGER ] amount [ REAL ] payment_date [ DATETIME ] last_update [ DATETIME ] rental : rental_id [ INTEGER ] primary_key rental_date [ DATETIME ] inventory_id [ INTEGER ] customer_id [ INTEGER ] return_date [ DATETIME ] staff_id [ INTEGER ] last_update [ DATETIME ] staff : staff_id [ INTEGER ] primary_key first_name [ TEXT ] last_name [ TEXT ] address_id [ INTEGER ] picture [ BLOB ] email [ TEXT ] store_id [ INTEGER ] active [ INTEGER ] username [ TEXT ] password [ TEXT ] last_update [ DATETIME ] store : store_id [ INTEGER ] primary_key manager_staff_id [ INTEGER ] address_id [ INTEGER ] last_update [ DATETIME ] Please write me a SQL statement that answers the following question: Which category is the film "Beach Heartbreakers" falls into? [/INST]
SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'BEACH HEARTBREAKERS';