Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What is the name of the language that the film 'AIRPORT POLLOCK' is in? [/INST]

Output: SELECT T2.name FROM film AS T1 JOIN LANGUAGE AS T2 ON T1.language_id  =  T2.language_id WHERE T1.title  =  'AIRPORT POLLOCK';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: How many stores are there? [/INST]

Output: SELECT count(*) FROM store;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of stores. [/INST]

Output: SELECT count(*) FROM store;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: How many kinds of different ratings are listed? [/INST]

Output: SELECT count(DISTINCT rating) FROM film;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of different film ratings. [/INST]

Output: SELECT count(DISTINCT rating) FROM film;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Which movies have 'Deleted Scenes' as a substring in the special feature? [/INST]

Output: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the titles of films that include 'Deleted Scenes' in their special feature section. [/INST]

Output: SELECT title FROM film WHERE special_features LIKE '%Deleted Scenes%';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: How many items in inventory does store 1 have? [/INST]

Output: SELECT count(*) FROM inventory WHERE store_id  =  1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Count the number of items store 1 has in stock. [/INST]

Output: SELECT count(*) FROM inventory WHERE store_id  =  1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: When did the first payment happen? [/INST]

Output: SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What was the date of the earliest payment? [/INST]

Output: SELECT payment_date FROM payment ORDER BY payment_date ASC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Where does the customer with the first name Linda live? And what is her email? [/INST]

Output: SELECT T2.address ,  T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id  =  T1.address_id WHERE T1.first_name  =  'LINDA';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the address and email of the customer with the first name Linda. [/INST]

Output: SELECT T2.address ,  T1.email FROM customer AS T1 JOIN address AS T2 ON T2.address_id  =  T1.address_id WHERE T1.first_name  =  'LINDA';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Find all the films longer than 100 minutes, or rated PG, except those who cost more than 200 for replacement. List the titles. [/INST]

Output: SELECT title FROM film WHERE LENGTH  >  100 OR rating  =  'PG' EXCEPT SELECT title FROM film WHERE replacement_cost  >  200;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What are the titles of films that are either longer than 100 minutes or rated PG other than those that cost more than 200 to replace? [/INST]

Output: SELECT title FROM film WHERE LENGTH  >  100 OR rating  =  'PG' EXCEPT SELECT title FROM film WHERE replacement_cost  >  200;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What is the first name and the last name of the customer who made the earliest rental? [/INST]

Output: SELECT T1.first_name ,  T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id  =  T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the full name of the customer who made the first rental. [/INST]

Output: SELECT T1.first_name ,  T1.last_name FROM customer AS T1 JOIN rental AS T2 ON T1.customer_id  =  T2.customer_id ORDER BY T2.rental_date ASC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What is the full name of the staff member who has rented a film to a customer with the first name April and the last name Burns? [/INST]

Output: SELECT DISTINCT T1.first_name ,  T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id  =  T2.staff_id JOIN customer AS T3 ON T2.customer_id  =  T3.customer_id WHERE T3.first_name  =  'APRIL' AND T3.last_name  =  'BURNS';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the full name of the staff who provided a customer with the first name April and the last name Burns with a film rental. [/INST]

Output: SELECT DISTINCT T1.first_name ,  T1.last_name FROM staff AS T1 JOIN rental AS T2 ON T1.staff_id  =  T2.staff_id JOIN customer AS T3 ON T2.customer_id  =  T3.customer_id WHERE T3.first_name  =  'APRIL' AND T3.last_name  =  'BURNS';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Which store has most the customers? [/INST]

Output: SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the id of the store with the most customers. [/INST]

Output: SELECT store_id FROM customer GROUP BY store_id ORDER BY count(*) DESC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What is the largest payment amount? [/INST]

Output: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the amount of the largest payment. [/INST]

Output: SELECT amount FROM payment ORDER BY amount DESC LIMIT 1;


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Where does the staff member with the first name Elsa live? [/INST]

Output: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id  =  T2.address_id WHERE T1.first_name  =  'Elsa';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Give the address of the staff member who has the first name Elsa. [/INST]

Output: SELECT T2.address FROM staff AS T1 JOIN address AS T2 ON T1.address_id  =  T2.address_id WHERE T1.first_name  =  'Elsa';


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: What are the first names of customers who have not rented any films after '2005-08-23 02:06:01'? [/INST]

Output: SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date  >  '2005-08-23 02:06:01' );


Input:
[INST] Here is a database schema:
actor :
actor_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ TEXT ]

address :
address_id [ INT ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INT ] address.city_id = city.city_id
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ TEXT ]

category :
category_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

city :
city_id [ INT ] primary_key
city [ TEXT ]
country_id [ INT ] city.country_id = country.country_id
last_update [ TEXT ]

country :
country_id [ INT ] primary_key
country [ TEXT ]
last_update [ TEXT ]

customer :
customer_id [ INT ] primary_key
store_id [ INT ] customer.store_id = store.store_id
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INT ] customer.address_id = address.address_id
active [ TEXT ]
create_date [ TEXT ]
last_update [ TEXT ]

film :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INT ] film.language_id = language.language_id
original_language_id [ INT ] film.original_language_id = language.language_id
rental_duration [ INT ]
rental_rate [ INT ]
length [ INT ]
replacement_cost [ INT ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ TEXT ]

film_actor :
actor_id [ INT ] primary_key film_actor.actor_id = actor.actor_id
film_id [ INT ] film_actor.film_id = film.film_id
last_update [ TEXT ]

film_category :
film_id [ INT ] primary_key film_category.film_id = film.film_id
category_id [ INT ] film_category.category_id = category.category_id
last_update [ TEXT ]

film_text :
film_id [ INT ] primary_key
title [ TEXT ]
description [ TEXT ]

inventory :
inventory_id [ INT ] primary_key
film_id [ INT ] inventory.film_id = film.film_id
store_id [ INT ] inventory.store_id = store.store_id
last_update [ TEXT ]

language :
language_id [ INT ] primary_key
name [ TEXT ]
last_update [ TEXT ]

payment :
payment_id [ INT ] primary_key
customer_id [ INT ] payment.customer_id = customer.customer_id
staff_id [ INT ] payment.staff_id = staff.staff_id
rental_id [ INT ] payment.rental_id = rental.rental_id
amount [ INT ]
payment_date [ TEXT ]
last_update [ TEXT ]

rental :
rental_id [ INT ] primary_key
rental_date [ TEXT ]
inventory_id [ INT ] rental.inventory_id = inventory.inventory_id
customer_id [ INT ] rental.customer_id = customer.customer_id
return_date [ TEXT ]
staff_id [ INT ] rental.staff_id = staff.staff_id
last_update [ TEXT ]

staff :
staff_id [ INT ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INT ] staff.address_id = address.address_id
picture [ TEXT ]
email [ TEXT ]
store_id [ INT ]
active [ TEXT ]
username [ TEXT ]
password [ TEXT ]
last_update [ TEXT ]

store :
store_id [ INT ] primary_key
manager_staff_id [ INT ] store.manager_staff_id = staff.staff_id
address_id [ INT ] store.address_id = address.address_id
last_update [ TEXT ]

Please write me a SQL statement that answers the following question: Return the first names of customers who did not rented a film after the date '2005-08-23 02:06:01'. [/INST]

Output: SELECT first_name FROM customer WHERE customer_id NOT IN( SELECT customer_id FROM rental WHERE rental_date  >  '2005-08-23 02:06:01' );


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: How many bank branches are there? [/INST]

Output: SELECT count(*) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Count the number of bank branches. [/INST]

Output: SELECT count(*) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: How many customers are there? [/INST]

Output: SELECT sum(no_of_customers) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of customers across banks? [/INST]

Output: SELECT sum(no_of_customers) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the number of customers in the banks at New York City. [/INST]

Output: SELECT sum(no_of_customers) FROM bank WHERE city  =  'New York City';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What is the total number of customers who use banks in New York City? [/INST]

Output: SELECT sum(no_of_customers) FROM bank WHERE city  =  'New York City';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the average number of customers in all banks of Utah state. [/INST]

Output: SELECT avg(no_of_customers) FROM bank WHERE state  =  'Utah';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What is the average number of customers across banks in the state of Utah? [/INST]

Output: SELECT avg(no_of_customers) FROM bank WHERE state  =  'Utah';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the average number of customers cross all banks. [/INST]

Output: SELECT avg(no_of_customers) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What is the average number of bank customers? [/INST]

Output: SELECT avg(no_of_customers) FROM bank;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the city and state of the bank branch named morningside. [/INST]

Output: SELECT city ,  state FROM bank WHERE bname  =  'morningside';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What city and state is the bank with the name morningside in? [/INST]

Output: SELECT city ,  state FROM bank WHERE bname  =  'morningside';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the branch names of banks in the New York state. [/INST]

Output: SELECT bname FROM bank WHERE state  =  'New York';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What are the names of banks in the state of New York? [/INST]

Output: SELECT bname FROM bank WHERE state  =  'New York';


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: List the name of all customers sorted by their account balance in ascending order. [/INST]

Output: SELECT cust_name FROM customer ORDER BY acc_bal;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What are the names of all customers, ordered by account balance? [/INST]

Output: SELECT cust_name FROM customer ORDER BY acc_bal;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: List the name of all different customers who have some loan sorted by their total loan amount. [/INST]

Output: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount);


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What are the names of the different customers who have taken out a loan, ordered by the total amount that they have taken? [/INST]

Output: SELECT T1.cust_name FROM customer AS T1 JOIN loan AS T2 ON T1.cust_id  =  T2.cust_id GROUP BY T1.cust_name ORDER BY sum(T2.amount);


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: Find the state, account type, and credit score of the customer whose number of loan is 0. [/INST]

Output: SELECT state ,  acc_type ,  credit_score FROM customer WHERE no_of_loans  =  0;


Input:
[INST] Here is a database schema:
bank :
branch_ID [ INT ] primary_key
bname [ TEXT ]
no_of_customers [ INT ]
city [ TEXT ]
state [ TEXT ]

customer :
cust_ID [ TEXT ] primary_key
cust_name [ TEXT ]
acc_type [ TEXT ]
acc_bal [ INT ]
no_of_loans [ INT ]
credit_score [ INT ]
branch_ID [ INT ] customer.branch_ID = bank.branch_ID
state [ TEXT ]

loan :
loan_ID [ TEXT ] primary_key
loan_type [ TEXT ]
cust_ID [ TEXT ]
branch_ID [ TEXT ] loan.branch_ID = bank.branch_ID
amount [ INT ]

Please write me a SQL statement that answers the following question: What are the states, account types, and credit scores for customers who have 0 loans? [/INST]

Output: SELECT state ,  acc_type ,  credit_score FROM customer WHERE no_of_loans  =  0;