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 film has the highest rental rate? And what is the rate? [/INST]

Output: SELECT title ,  rental_rate FROM film ORDER BY rental_rate 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 are the title and rental rate of the film with the highest rental rate? [/INST]

Output: SELECT title ,  rental_rate FROM film ORDER BY rental_rate 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: Which film has the most number of actors or actresses? List the film name, film id and description. [/INST]

Output: SELECT T2.title ,  T2.film_id ,  T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id  =  T2.film_id GROUP BY T2.film_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 are the title, id, and description of the movie with the greatest number of actors? [/INST]

Output: SELECT T2.title ,  T2.film_id ,  T2.description FROM film_actor AS T1 JOIN film AS T2 ON T1.film_id  =  T2.film_id GROUP BY T2.film_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: Which film actor (actress) starred the most films? List his or her first name, last name and actor id. [/INST]

Output: SELECT T2.first_name ,  T2.last_name ,  T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id  =  T2.actor_id GROUP BY T2.actor_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 full name and id of the actor or actress who starred in the greatest number of films. [/INST]

Output: SELECT T2.first_name ,  T2.last_name ,  T2.actor_id FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id  =  T2.actor_id GROUP BY T2.actor_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: Which film actors (actresses) played a role in more than 30 films? List his or her first name and last name. [/INST]

Output: SELECT T2.first_name ,  T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id  =  T2.actor_id GROUP BY T2.actor_id HAVING count(*)  >  30;


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 full names of actors who had roles in more than 30 films? [/INST]

Output: SELECT T2.first_name ,  T2.last_name FROM film_actor AS T1 JOIN actor AS T2 ON T1.actor_id  =  T2.actor_id GROUP BY T2.actor_id HAVING count(*)  >  30;


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 owns most items? [/INST]

Output: SELECT store_id FROM inventory 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 id of the store that has the most items in inventory? [/INST]

Output: SELECT store_id FROM inventory 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 total amount of all payments? [/INST]

Output: SELECT sum(amount) FROM payment;


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 sum of all payment amounts. [/INST]

Output: SELECT sum(amount) FROM payment;


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 customer, who has made at least one payment, has spent the least money? List his or her first name, last name, and the id. [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) 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 and id of the customer who has the lowest total amount of payment? [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T1.customer_id FROM customer AS T1 JOIN payment AS T2 ON T1.customer_id  =  T2.customer_id GROUP BY T1.customer_id ORDER BY sum(amount) 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 genre name of the film HUNGER ROOF? [/INST]

Output: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id  =  T2.category_id JOIN film AS T3 ON T2.film_id  =  T3.film_id WHERE T3.title  =  'HUNGER ROOF';


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 name of the category to which the film 'HUNGER ROOF' belongs. [/INST]

Output: SELECT T1.name FROM category AS T1 JOIN film_category AS T2 ON T1.category_id  =  T2.category_id JOIN film AS T3 ON T2.film_id  =  T3.film_id WHERE T3.title  =  'HUNGER ROOF';


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 films are there in each category? List the genre name, genre id and the count. [/INST]

Output: SELECT T2.name ,  T1.category_id ,  count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id  =  T2.category_id GROUP BY T1.category_id;


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 names and ids of the different categories, and how many films are in each? [/INST]

Output: SELECT T2.name ,  T1.category_id ,  count(*) FROM film_category AS T1 JOIN category AS T2 ON T1.category_id  =  T2.category_id GROUP BY T1.category_id;


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 film has the most copies in the inventory? List both title and id. [/INST]

Output: SELECT T1.title ,  T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id GROUP BY T1.film_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 title and id of the film that has the greatest number of copies in inventory? [/INST]

Output: SELECT T1.title ,  T1.film_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id GROUP BY T1.film_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 film title and inventory id of the item in the inventory which was rented most frequently? [/INST]

Output: SELECT T1.title ,  T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id JOIN rental AS T3 ON T2.inventory_id  =  T3.inventory_id GROUP BY T2.inventory_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 title and inventory id of the film that is rented most often. [/INST]

Output: SELECT T1.title ,  T2.inventory_id FROM film AS T1 JOIN inventory AS T2 ON T1.film_id  =  T2.film_id JOIN rental AS T3 ON T2.inventory_id  =  T3.inventory_id GROUP BY T2.inventory_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: How many languages are in these films? [/INST]

Output: SELECT count(DISTINCT language_id) 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 languages in these films. [/INST]

Output: SELECT count(DISTINCT language_id) 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: What are all the movies rated as R? List the titles. [/INST]

Output: SELECT title FROM film WHERE rating  =  'R';


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 any movies with an R rating. [/INST]

Output: SELECT title FROM film WHERE rating  =  'R';


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 is store 1 located? [/INST]

Output: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id  =  T2.address_id 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: Return the address of store 1. [/INST]

Output: SELECT T2.address FROM store AS T1 JOIN address AS T2 ON T1.address_id  =  T2.address_id 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: Which staff handled least number of payments? List the full name and the id. [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) 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: Give the full name and staff id of the staff who has handled the fewest payments. [/INST]

Output: SELECT T1.first_name ,  T1.last_name ,  T1.staff_id FROM staff AS T1 JOIN payment AS T2 ON T1.staff_id  =  T2.staff_id GROUP BY T1.staff_id ORDER BY count(*) 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: Which language does the film AIRPORT POLLOCK use? List the language name. [/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';