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: List at least 10 films that falls into 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';
[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 among the actors starred in a NC-17 rated film? Provide only the last name of the actors. [/INST]
SELECT T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'NC-17';
[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 average rate of renting the film that Lucille Tracy got starred. [/INST]
SELECT AVG(T3.rental_rate) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'LUCILLE' AND T1.last_name = 'TRACY';
[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 have a duration between 100 to 110 minutes? [/INST]
SELECT COUNT(film_id) FROM film WHERE length BETWEEN 100 AND 110;
[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 ID of actors with Dee as their last name. [/INST]
SELECT actor_id FROM actor WHERE last_name = 'Dee';
[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 active customers, how many of them have Nina as their first name? [/INST]
SELECT COUNT(customer_id) FROM customer WHERE first_name = 'Nina' AND 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: In store ID 2, how many of the films are R rating? [/INST]
SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 AND T1.rating = 'R';
[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 store ID of the films starred by Reese West with a duration of 100 minutes and below? [/INST]
SELECT T4.store_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length < 100 AND T1.first_name = 'Reese' AND T1.last_name = 'West';
[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 duration of the film starred by Nick Wahlberg with the highest rental rate. [/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 = 'Nick' AND T1.last_name = 'Wahlberg' 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: What are the titles of the films starred by Russell Close? [/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 = 'Russell' AND T2.last_name = 'Close';
[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 store ID of the film titled "Amadeus Holy". [/INST]
SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'Amadeus Holy';
[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: In films with a rental rate of 2.99, how many of the films are starred by Nina Soto? [/INST]
SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate = 2.99 AND T2.first_name = 'Nina' AND T2.last_name = 'Soto';
[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 films starred by Reese West, what is the difference between the films that have store ID of 1 and store ID of 2? [/INST]
SELECT SUM(IIF(T4.film_id = 1, 1, 0)) - SUM(IIF(T4.film_id = 2, 1, 0)) AS diff FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T2.first_name = 'Reese' AND T2.last_name = 'West';
[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 postal code of the address 692 Joliet Street? [/INST]
SELECT postal_code FROM address WHERE 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: How many customers are 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: Among all the customers of store no.1, how many of them are active? [/INST]
SELECT COUNT(customer_id) FROM customer WHERE active = 1 AND 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: What is the address of Mary Smith? [/INST]
SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH';
[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 all the active customers, how many of them live in Arlington? [/INST]
SELECT COUNT(T2.customer_id) FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T1.city_id = T3.city_id WHERE T2.active = 1 AND T3.city = 'Arlington';
[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 the full names of all the customers who live in Italy. [/INST]
SELECT T4.first_name, T4.last_name FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T3.country = 'Italy';
[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 Mary Smith live in? [/INST]
SELECT T3.country FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id WHERE T4.first_name = 'MARY' AND T4.last_name = 'SMITH';
[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 biggest amount of payment for a rental made by Mary Smith? [/INST]
SELECT T1.amount FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' ORDER BY T1.amount DESC LIMIT 1;
[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 times has Mary Smith rented a film? [/INST]
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH';
[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 total amount of money Mary Smith has spent on film rentals? [/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 = 'MARY' AND T2.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: Among the times Mary Smith had rented a movie, how many of them happened in June, 2005? [/INST]
SELECT COUNT(T1.customer_id) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND STRFTIME('%Y',T1.payment_date) = '2005' AND STRFTIME('%Y', T1.payment_date) = '6';
[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 full name of the customer who had made the biggest amount of payment in one single film rental. [/INST]
SELECT T2.first_name, T2.last_name FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id ORDER BY T1.amount DESC LIMIT 1;
[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 much in total had the customers in Italy spent on film rentals? [/INST]
SELECT SUM(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy';
[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 payments made by Mary Smith, how many of them are over 4.99? [/INST]
SELECT COUNT(T1.amount) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'MARY' AND T2.last_name = 'SMITH' AND T1.amount > 4.99;
[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 amount of money spent by a customer in Italy on a single film rental? [/INST]
SELECT AVG(T5.amount) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id INNER JOIN country AS T3 ON T2.country_id = T3.country_id INNER JOIN customer AS T4 ON T1.address_id = T4.address_id INNER JOIN payment AS T5 ON T4.customer_id = T5.customer_id WHERE T3.country = 'Italy';