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 the actors' IDs who have "KILMER" as last name. [/INST] | SELECT actor_id FROM actor WHERE 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: List down the films titles with the lowest replacement cost under the general audiences rating. [/INST] | SELECT title FROM film WHERE replacement_cost = ( SELECT MIN(replacement_cost) 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: Among the films with the longest duration, list any five title with their descriptions and special features. [/INST] | SELECT title, description, special_features FROM film WHERE length = ( SELECT MAX(length) FROM film ) 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: How many films rented on 26th May, 2005 were returned on 30th May, 2005? [/INST] | SELECT COUNT(DISTINCT rental_id) FROM rental WHERE date(rental_date) BETWEEN '2005-05-26' AND '2005-05-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: Calculate the average payment amount per customer. [/INST] | SELECT AVG(amount) FROM payment GROUP BY 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: What is the name and email of the staff in store ID 2? [/INST] | SELECT first_name, last_name, email FROM staff WHERE store_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: How many percent of customers were inactive? [/INST] | SELECT CAST(SUM(IIF(active = 0, 1, 0)) AS REAL) * 100 / COUNT(customer_id) FROM customer; |
[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 description and film title of ID 996? [/INST] | SELECT description, title FROM film_text WHERE film_id = 996; |
[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 customers' total payment amount in August, 2005. [/INST] | SELECT SUM(amount) FROM payment WHERE SUBSTR(payment_date, 1, 7) = '2005-08'; |
[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 film titles performed by Emily Dee. [/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 = 'Emily' AND T1.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: List down the actors' full names who performed in "CHOCOLATE DUCK" film. [/INST] | SELECT T3.first_name, T3.last_name FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T2.title = 'CHOCOLATE DUCK'; |
[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 the horror category were included in PG-13-rated? [/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 = 'Horror' 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: Distinguish the films performed by Judy Dean according to category. [/INST] | SELECT T5.name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T2.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T1.first_name = 'Judy' AND T1.last_name = 'Dean'; |
[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 any five film names under the documentary 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 = 'Documentary' 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: Mention the language of Untouchables Sunrise film and calculate its rental cost per day. [/INST] | SELECT T2.name, T1.replacement_cost / T1.rental_duration AS cost FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'UNTOUCHABLES SUNRISE'; |
[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 films' titles which were rented on 24th May,2005. [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE SUBSTR(T3.rental_date, 1, 10) = '2005-05-24'; |
[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 films' titles which were rented by Brian Wyman in July, 2005. [/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 = 'BRIAN' AND T1.last_name = 'WYMAN' AND STRFTIME('%Y', T2.rental_date) = '2005' AND STRFTIME('%m',T2.rental_date) = '7'; |
[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 inventories' IDs and actors' names of "STREETCAR INTENTIONS". [/INST] | SELECT T4.inventory_id, T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T2.film_id = T4.film_id WHERE T3.title = 'STREETCAR INTENTIONS'; |
[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 rented by Natalie Meyer, describe the titles and categories of the films which were rented in February 2006. [/INST] | SELECT T3.title, T2.name FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'Natalie' AND T5.last_name = 'Meyer' AND STRFTIME('%Y',T3.rental_rate) = '2006' AND STRFTIME('%m',T3.rental_rate) = '2'; |
[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 rental IDs belong to Eleanor Hunt? [/INST] | SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'Eleanor' AND T2.last_name = 'Hunt'; |
[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: Describe the full names and cities of the customers who rented "DREAM PICKUP". [/INST] | SELECT T4.first_name, T4.last_name, T6.city FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN customer AS T4 ON T3.customer_id = T4.customer_id INNER JOIN address AS T5 ON T4.address_id = T5.address_id INNER JOIN city AS T6 ON T5.city_id = T6.city_id WHERE T1.title = 'DREAM PICKUP'; |
[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 how many percent of customers were located in India. [/INST] | SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) * 100 / COUNT(T4.customer_id) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id; |
[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 percentage of the film did Mary Keitel perform more than Angela Witherspoon? [/INST] | SELECT CAST((SUM(IIF(T1.first_name = 'ANGELA' AND T1.last_name = 'WITHERSPOON', 1, 0)) - SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0))) AS REAL) * 100 / SUM(IIF(T1.first_name = 'MARY' AND T1.last_name = 'KEITEL', 1, 0)) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id; |
[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 email, address, city, and country of the customer Lillie Kim. [/INST] | SELECT T1.email, T2.address, T3.city, T4.country FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id WHERE T1.first_name = 'Lillie' AND T1.last_name = 'Kim'; |
[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 any 5 customers' full names who have rented from Mike Hillyer. [/INST] | SELECT T3.first_name, T3.last_name FROM staff AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.first_name = 'Mike' AND T1.last_name = 'Hillyer' LIMIT 5; |
[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 by Diane Collins. [/INST] | SELECT SUM(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'Diane' AND T1.last_name = 'Collins'; |
[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 names and emails of customers whose payments were greater than 70% of the average. [/INST] | SELECT DISTINCT T2.first_name, T2.last_name, T2.email FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id WHERE T1.amount > ( SELECT AVG(amount) FROM payment ) * 0.7; |
[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 rental rate of 0.99? [/INST] | SELECT COUNT(film_id) FROM film WHERE rental_rate = 0.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: Among the customers with customer ID of 100 and below, how many of them have Thomas as their last name? [/INST] | SELECT COUNT(customer_id) FROM customer WHERE last_name = 'Thomas' AND customer_id < 100; |
[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 actor's last name that starred the film with the description of "A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies". [/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.description = 'A Thoughtful Drama of a Composer And a Feminist who must Meet a Secret Agent in The Canadian Rockies'; |
[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 title of the film starred by Liza Bergman with the highest replacement cost. [/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 = 'Liza' AND T1.last_name = 'Bergman' ORDER BY replacement_cost 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: Among films with store ID of 2, list the title of films with the highest rental rate. [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2 ORDER BY rental_rate DESC LIMIT 1; |
[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 Angelina Astaire, what is the title of the film with a replacement cost of 27.99? [/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 = 'Angelina' AND T1.last_name = 'Astaire' AND T3.replacement_cost = 27.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: List the inventory ID of the film titled "African Egg". [/INST] | SELECT T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.title = 'African Egg'; |
[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 length duration of 113 minutes, how many of the films are starred by Kirk Jovovich? [/INST] | SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.length = 113 AND T1.first_name = 'Kirk' AND T1.last_name = 'Jovovich'; |
[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 the film with an inventory ID between 20 to 60, how many of the films have a G 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.inventory_id BETWEEN 20 AND 60 AND T1.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: Among films with a rental rate of 4.99, what is the total number of films starred by Bob Fawcett? [/INST] | SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rental_rate = 4.99 AND T1.first_name = 'Bob' AND T1.last_name = 'Fawcett'; |
[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 the films starred by Russell Close with a duration between 110 to 150 minutes? [/INST] | SELECT T4.inventory_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.last_name = 'Close'; |
[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 store and inventory ID of the film with the longest duration? [/INST] | SELECT T2.store_id, T2.inventory_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id ORDER BY T1.length DESC LIMIT 1; |
[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 titles of the films starred by Elvis Marx. [/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 T3.length BETWEEN 110 AND 150 AND T1.first_name = 'Russell' AND T1.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: In films with rental rate of 4.99, list down the inventory ID of the films starred by Lucille Dee. [/INST] | SELECT T4.inventory_id FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN inventory AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'Lucille' AND T1.last_name = 'Dee' AND T3.rental_rate = 4.99; |
[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 with a rental rate greater than the 60% of average rental rate of all listed films. [/INST] | SELECT T2.store_id FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T1.rental_rate > ( SELECT AVG(T1.rental_rate) * 0.6 FROM film AS T1 ); |
[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 Nick Wahlberg, what is the percentage of the films with G rating? [/INST] | SELECT CAST(SUM(IIF(T3.rating = 'G', 1, 0)) AS REAL) / COUNT(T3.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Elvis' AND T1.last_name = 'Marx'; |
[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 address in Texas in the ascending order of city id. [/INST] | SELECT address FROM address WHERE district = 'Texas' AND city_id = ( SELECT MIN(city_id) FROM address WHERE district = 'Texas' ); |
[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: Find the full name and email address of inactive customers whose record was created in 2006. [/INST] | SELECT first_name, last_name, email FROM customer WHERE STRFTIME('%Y',create_date) = '2006' AND 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: What percentage of the movies are PG-13? [/INST] | SELECT CAST(SUM(IIF(rating = 'PG-13', 1, 0)) AS REAL) * 100 / COUNT(film_id) 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: Please list the top ten movies with the most price per day in descending order of price per day. [/INST] | SELECT title FROM film ORDER BY rental_rate / rental_duration DESC LIMIT 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: Calculate the average rent amount paid by the customer with customer id 15. [/INST] | SELECT AVG(amount) FROM payment WHERE customer_id = 15; |
[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 rented for an above-average period? [/INST] | SELECT COUNT(customer_id) FROM rental WHERE return_date - rental_date > ( SELECT AVG(return_date - rental_date) FROM rental ); |
[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 movies, what percentage are horror? [/INST] | SELECT CAST(SUM(IIF(T2.name = 'horror', 1, 0)) AS REAL) * 100 / COUNT(T2.category_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id; |
[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 who acted in the most number of movies? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[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 who acted the most in drama movies? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id WHERE T3.category_id = 7 GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[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 difference in the average number of films rented each day in Australia and Canada? [/INST] | SELECT AVG(IIF(T4.country = 'Australia', 1, 0)) - AVG(IIF(T4.country = 'Canada', 1, 0)) AS diff FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id INNER JOIN city AS T3 ON T2.city_id = T3.city_id INNER JOIN country AS T4 ON T3.country_id = T4.country_id; |
[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: Of the movies in which Reese Kilmer acted, what percentage are action movies? [/INST] | SELECT CAST(SUM(IIF(T4.name = 'Action', 1, 0)) AS REAL) * 100 / COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film_category AS T3 ON T2.film_id = T3.film_id INNER JOIN category AS T4 ON T3.category_id = T4.category_id WHERE T1.first_name = 'Reese' AND T1.last_name = 'Kilmer'; |
[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 total amount of rent for the movie Clockwork Paradice. [/INST] | SELECT SUM(T1.amount) FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.title = 'CLOCKWORK PARADICE'; |
[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: Find and list the full name of customers who rented more than five types of movies. [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id GROUP BY T1.first_name, T1.last_name ) AS T WHERE T.num > 5; |
[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 number of actors acted in comedy movies? [/INST] | SELECT AVG(T1.actor_id) FROM film_actor AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN actor AS T4 ON T4.actor_id = T1.actor_id WHERE T3.name = 'comedy'; |
[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 children's movies, which was rented the most? [/INST] | SELECT T.title FROM ( SELECT T4.title, COUNT(T4.title) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id INNER JOIN film_category AS T5 ON T4.film_id = T5.film_id INNER JOIN category AS T6 ON T5.category_id = T6.category_id WHERE T6.name = 'Children' GROUP BY T4.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: Calculate the percentage of customers who paid more than the average rent amount in store 1. [/INST] | SELECT CAST(( SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T2.amount > ( SELECT AVG(amount) FROM payment ) ) AS REAL) * 100 / ( SELECT COUNT(customer_id) FROM customer ); |
[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: Find and list the full name of customers who rented more family movies than Sci-Fi movies. [/INST] | SELECT DISTINCT IIF(SUM(IIF(T5.name = 'Family', 1, 0)) - SUM(IIF(T5.name = 'Sci-Fi', 1, 0)) > 0, T1.first_name, 0) 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_category AS T4 ON T4.film_id = T3.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id GROUP BY T1.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: Indicate the title of all the films rated as 'Adults Only'. [/INST] | SELECT title FROM film WHERE 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: How many actors with the surname Kilmer are there? [/INST] | SELECT COUNT(actor_id) FROM actor WHERE 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 movies have a length longer than 100? [/INST] | SELECT COUNT(film_id) FROM film WHERE length > 100; |
[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 payments were made throughout the month of August 2005? [/INST] | SELECT SUM(amount) FROM payment WHERE payment_date LIKE '2005-08%'; |
[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: To which country does the address '1386 Nakhon Sawan Boulevard' belong? [/INST] | SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id WHERE T3.address = '1386 Nakhon Sawan Boulevard'; |
[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 language was the most used in movies released in 2006? [/INST] | SELECT T.language_id FROM ( SELECT T1.language_id, COUNT(T1.language_id) AS num FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE STRFTIME('%Y',T1.release_year) = '2006' GROUP BY T1.language_id ) AS T ORDER BY T.num DESC LIMIT 1; |
[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 title of all the films that are in the Classics category. [/INST] | SELECT T2.title FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id WHERE T3.name = 'Classics'; |
[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 rentals did Ella Oliver hire in June 2016? [/INST] | SELECT COUNT(T1.rental_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.first_name = 'ELLA' AND T2.last_name = 'ELLA' AND date(T1.rental_date) BETWEEN '2005-06-01' AND '2005-06-30'; |
[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 different clients have rented materials from Jon Stephens? [/INST] | SELECT COUNT(T1.customer_id) FROM rental AS T1 INNER JOIN staff AS T2 ON T1.staff_id = T2.staff_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'; |
[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 paid for rentals made on July 29, 2005? [/INST] | SELECT SUM(T2.amount) FROM rental AS T1 INNER JOIN payment AS T2 ON T1.rental_id = T2.rental_id WHERE date(T1.rental_date) = '2005-07-29%'; |
[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 first name of the customers whose address is in the postal code that begins with 76? [/INST] | SELECT T1.first_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE SUBSTR(T2.postal_code, 1, 2) = '76'; |
[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: On what date was the rented material for the movie BLOOD ARGONAUTS returned? [/INST] | SELECT T1.rental_date FROM rental AS T1 INNER JOIN inventory AS T2 ON T1.inventory_id = T2.inventory_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'BLOOD ARGONAUTS'; |
[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 films in which Cuba Allen acted? [/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 = 'Cuba' AND T1.last_name = 'Allen'; |
[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 actors acted in movies in the Music category? [/INST] | SELECT COUNT(T1.actor_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN film_category AS T4 ON T3.film_id = T4.film_id INNER JOIN category AS T5 ON T4.category_id = T5.category_id WHERE T5.name = 'Music'; |
[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 full name of the actor who has acted the most times in comedy films? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T4.first_name, T4.last_name, COUNT(T2.actor_id) AS num FROM film_category AS T1 INNER JOIN film_actor AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id INNER JOIN actor AS T4 ON T2.actor_id = T4.actor_id WHERE T3.name = 'Comedy' GROUP BY T4.first_name, T4.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[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 did not rent material at Mike's store? [/INST] | SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.manager_staff_id = T3.staff_id WHERE T3.first_name != 'Mike'; |
[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 name of the actors of the films rated as 'Parents Strongly Precautioned' with the highest replacement cost. [/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.rating = 'PG-13' ORDER BY T3.replacement_cost 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 name of the client who has the largest quantity of rented material without returning it? [/INST] | SELECT T.first_name FROM ( SELECT T2.first_name, COUNT(T1.rental_date) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[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 live in the city of Miyakonojo? [/INST] | SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Miyakonojo'; |
[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 non-active clients have not returned the rented material? [/INST] | SELECT COUNT(T2.customer_id) FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id WHERE T2.active = 0; |
[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 animated films that have the shortest 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 T2.category_id = T3.category_id ORDER BY T1.length 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: In which country is the store where Hector Poinexter rents equipment located? [/INST] | SELECT T5.country FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN address AS T3 ON T2.address_id = T3.address_id INNER JOIN city AS T4 ON T3.city_id = T4.city_id INNER JOIN country AS T5 ON T4.country_id = T5.country_id WHERE T1.first_name = 'HECTOR' AND T1.last_name = 'POINDEXTER'; |
[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 payment in Horror movies? [/INST] | SELECT AVG(T5.amount) FROM category AS T1 INNER JOIN film_category AS T2 ON T1.category_id = T2.category_id INNER JOIN inventory AS T3 ON T2.film_id = T3.film_id INNER JOIN rental AS T4 ON T3.inventory_id = T4.inventory_id INNER JOIN payment AS T5 ON T4.rental_id = T5.rental_id WHERE T1.name = 'Horror'; |
[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 rent that Christy Vargas paid? [/INST] | SELECT AVG(T2.amount) FROM customer AS T1 INNER JOIN payment AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'CHRISTY' AND T1.Last_name = 'VARGAS'; |
[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 with a length of less than 100 belong to the Drama category? [/INST] | SELECT CAST(SUM(IIF(T2.length < 100 AND T3.name = 'Drama', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T1.category_id = T3.category_id; |
[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 actors that have the same forename as Johnny? Please include in your answer the full names of these actors. [/INST] | SELECT first_name, last_name FROM actor WHERE first_name = 'Johnny'; |
[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 address numbers that are located in Gansu district? [/INST] | SELECT address_id FROM address WHERE district = 'Gansu'; |
[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 three types of film along with their IDs and the latest update. [/INST] | SELECT DISTINCT name, category_id, last_update FROM category LIMIT 3; |
[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 any three inactive customers. [/INST] | SELECT first_name, last_name FROM customer WHERE active = 0 LIMIT 3; |
[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 rental price per day for Airplane Sierra? [/INST] | SELECT rental_rate / rental_duration AS result FROM film WHERE title = 'AIRPLANE SIERRA'; |
[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 is store number 2 located? [/INST] | SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2; |
[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 city does the address 1623 Kingstown Drive belong to? [/INST] | SELECT T1.city FROM city AS T1 INNER JOIN address AS T2 ON T2.city_id = T1.city_id WHERE T2.address = '1623 Kingstown Drive'; |
[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 name three cities that belong to Algeria. [/INST] | SELECT T2.city FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'Algeria'; |
[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 the film Agent Truman? [/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 = 'AGENT TRUMAN'; |
[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 titles of any three action films. [/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 = 'Action' LIMIT 3; |
[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 difference between the number of children's films and action films? [/INST] | SELECT SUM(IIF(T2.name = 'Children', 1, 0)) - SUM(IIF(T2.name = 'Action', 1, 0)) AS diff FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id; |
[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 district does Maria Miller live in? [/INST] | SELECT T2.district FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T1.first_name = 'Maria' AND T1.last_name = 'Miller'; |
[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 that is active and lives at 1795 Santiago de Compostela Way, Texas? [/INST] | SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN address AS T2 ON T1.address_id = T2.address_id WHERE T2.address = '1795 Santiago de Compostela Way' AND T1.active = 1; |
[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 English films have a duration of over 50 minutes and the cost of replacement are under 10.99? [/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.length > 50 AND T1.replacement_cost < 10.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: Who are the actors that act in the ACADEMY DINOSAUR film? [/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 = 'ACADEMY DINOSAUR'; |