input
stringlengths 358
16.1k
| output
stringlengths 24
805
|
---|---|
[INST] Here is a database schema:
station :
id [ INTEGER ] primary_key
name [ TEXT ]
lat [ REAL ]
long [ REAL ]
dock_count [ INTEGER ]
city [ TEXT ]
installation_date [ TEXT ]
status :
station_id [ INTEGER ]
bikes_available [ INTEGER ]
docks_available [ INTEGER ]
time [ TEXT ]
trip :
id [ INTEGER ] primary_key
duration [ INTEGER ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INTEGER ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INTEGER ]
bike_id [ INTEGER ]
subscription_type [ TEXT ]
zip_code [ INTEGER ]
weather :
date [ TEXT ]
max_temperature_f [ INTEGER ]
mean_temperature_f [ INTEGER ]
min_temperature_f [ INTEGER ]
max_dew_point_f [ INTEGER ]
mean_dew_point_f [ INTEGER ]
min_dew_point_f [ INTEGER ]
max_humidity [ INTEGER ]
mean_humidity [ INTEGER ]
min_humidity [ INTEGER ]
max_sea_level_pressure_inches [ REAL ]
mean_sea_level_pressure_inches [ REAL ]
min_sea_level_pressure_inches [ REAL ]
max_visibility_miles [ INTEGER ]
mean_visibility_miles [ INTEGER ]
min_visibility_miles [ INTEGER ]
max_wind_Speed_mph [ INTEGER ]
mean_wind_speed_mph [ INTEGER ]
max_gust_speed_mph [ INTEGER ]
precipitation_inches [ TEXT ]
cloud_cover [ INTEGER ]
events [ TEXT ]
wind_dir_degrees [ INTEGER ]
zip_code [ TEXT ]
Please write me a SQL statement that answers the following question: How many subscribers have ended their trip at MLK Library and how many docks does that station have? [/INST] | SELECT COUNT(T1.id), T2.dock_count FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.end_station_name = 'MLK Library' AND T1.subscription_type = 'Subscriber' AND T2.dock_count = 19; |
[INST] Here is a database schema:
station :
id [ INTEGER ] primary_key
name [ TEXT ]
lat [ REAL ]
long [ REAL ]
dock_count [ INTEGER ]
city [ TEXT ]
installation_date [ TEXT ]
status :
station_id [ INTEGER ]
bikes_available [ INTEGER ]
docks_available [ INTEGER ]
time [ TEXT ]
trip :
id [ INTEGER ] primary_key
duration [ INTEGER ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INTEGER ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INTEGER ]
bike_id [ INTEGER ]
subscription_type [ TEXT ]
zip_code [ INTEGER ]
weather :
date [ TEXT ]
max_temperature_f [ INTEGER ]
mean_temperature_f [ INTEGER ]
min_temperature_f [ INTEGER ]
max_dew_point_f [ INTEGER ]
mean_dew_point_f [ INTEGER ]
min_dew_point_f [ INTEGER ]
max_humidity [ INTEGER ]
mean_humidity [ INTEGER ]
min_humidity [ INTEGER ]
max_sea_level_pressure_inches [ REAL ]
mean_sea_level_pressure_inches [ REAL ]
min_sea_level_pressure_inches [ REAL ]
max_visibility_miles [ INTEGER ]
mean_visibility_miles [ INTEGER ]
min_visibility_miles [ INTEGER ]
max_wind_Speed_mph [ INTEGER ]
mean_wind_speed_mph [ INTEGER ]
max_gust_speed_mph [ INTEGER ]
precipitation_inches [ TEXT ]
cloud_cover [ INTEGER ]
events [ TEXT ]
wind_dir_degrees [ INTEGER ]
zip_code [ TEXT ]
Please write me a SQL statement that answers the following question: What is the average coldest temperature for the zip code of 94301 and what stations are within the zip code? Include the latitude and longitude as well. [/INST] | SELECT AVG(T3.min_temperature_f), T1.long, T1.lat FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301; |
[INST] Here is a database schema:
station :
id [ INTEGER ] primary_key
name [ TEXT ]
lat [ REAL ]
long [ REAL ]
dock_count [ INTEGER ]
city [ TEXT ]
installation_date [ TEXT ]
status :
station_id [ INTEGER ]
bikes_available [ INTEGER ]
docks_available [ INTEGER ]
time [ TEXT ]
trip :
id [ INTEGER ] primary_key
duration [ INTEGER ]
start_date [ TEXT ]
start_station_name [ TEXT ]
start_station_id [ INTEGER ]
end_date [ TEXT ]
end_station_name [ TEXT ]
end_station_id [ INTEGER ]
bike_id [ INTEGER ]
subscription_type [ TEXT ]
zip_code [ INTEGER ]
weather :
date [ TEXT ]
max_temperature_f [ INTEGER ]
mean_temperature_f [ INTEGER ]
min_temperature_f [ INTEGER ]
max_dew_point_f [ INTEGER ]
mean_dew_point_f [ INTEGER ]
min_dew_point_f [ INTEGER ]
max_humidity [ INTEGER ]
mean_humidity [ INTEGER ]
min_humidity [ INTEGER ]
max_sea_level_pressure_inches [ REAL ]
mean_sea_level_pressure_inches [ REAL ]
min_sea_level_pressure_inches [ REAL ]
max_visibility_miles [ INTEGER ]
mean_visibility_miles [ INTEGER ]
min_visibility_miles [ INTEGER ]
max_wind_Speed_mph [ INTEGER ]
mean_wind_speed_mph [ INTEGER ]
max_gust_speed_mph [ INTEGER ]
precipitation_inches [ TEXT ]
cloud_cover [ INTEGER ]
events [ TEXT ]
wind_dir_degrees [ INTEGER ]
zip_code [ TEXT ]
Please write me a SQL statement that answers the following question: Calculate the average duration travelled by subscribers that both started and ended their trip in Mountain View City Hall and indicate the date when the station was first installed. [/INST] | SELECT AVG(T1.duration), T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_station_name = 'Mountain View City Hall' AND T1.subscription_type = 'Subscriber' AND T1.end_station_name = 'Mountain View City Hall'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the description of the film ACADEMY DINOSAUR? [/INST] | SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films have a rental duration of over 6 days? [/INST] | SELECT COUNT(film_id) FROM film WHERE rental_duration > 6; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of the films that are released in 2006 and have a rental rate of $2.99. [/INST] | SELECT title FROM film WHERE release_year = 2006 AND rental_rate = 2.99; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which film has the longest duration of film screening? Please give its title. [/INST] | SELECT title FROM film ORDER BY length DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which film has a higher replacement cost, ACE GOLDFINGER or ACADEMY DINOSAUR? [/INST] | SELECT title FROM film WHERE title IN ('ACE GOLDFINGER', 'ACADEMY DINOSAUR') ORDER BY replacement_cost DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating? [/INST] | SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films with the rental rate of $2.99 have the special feature of "Deleted Scenes"? [/INST] | SELECT COUNT(film_id) FROM film WHERE rental_rate = 2.99 AND special_features = 'Deleted Scenes'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of all the films that have more than 2 special features. [/INST] | SELECT title FROM ( SELECT title, COUNT(special_features) AS num FROM film GROUP BY title ) AS T ORDER BY T.num > 2; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the email address of the staff Jon Stephens? [/INST] | SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please give the full names of all the active staff. [/INST] | SELECT first_name, last_name FROM staff WHERE active = 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: In which year was the film with the highest replacement cost released? [/INST] | SELECT DISTINCT release_year FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film ); |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of the top 3 films with the highest replacement cost. [/INST] | SELECT title FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film ) LIMIT 3; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the language of the film ACADEMY DINOSAUR? [/INST] | SELECT T2.name FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'ACADEMY DINOSAUR'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films are in English? [/INST] | SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of all the films starring the actor PENELOPE GUINESS. [/INST] | SELECT T2.title FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id INNER JOIN actor AS T3 ON T1.actor_id = T3.actor_id WHERE T3.first_name = 'PENELOPE' AND T3.last_name = 'GUINESS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many actors have starred in the film ACADEMY DINOSAUR? [/INST] | SELECT COUNT(T1.actor_id) FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id WHERE T2.title = 'ACADEMY DINOSAUR'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the full names of all the actors that have starred in the film ACADEMY DINOSAUR. [/INST] | SELECT T1.first_name, T1.last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.title = 'ACADEMY DINOSAUR'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films starring PENELOPE GUINESS, how many of them are released in 2006? [/INST] | SELECT COUNT(T2.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.release_year = 2006 AND T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please give the title of the film starring PENELOPE GUINESS and has the highest replacement cost. [/INST] | SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS' ORDER BY T3.replacement_cost DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the full names of all the actors that have starred in the film with the highest replacement cost. [/INST] | SELECT first_name, last_name FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id ORDER BY T3.replacement_cost DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films starring PENELOPE GUINESS, how many of them are in English? [/INST] | SELECT COUNT(T3.film_id) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id INNER JOIN language AS T4 ON T3.language_id = T4.language_id WHERE T4.name = 'English' AND T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the title of the film with the longest duration time and stars PENELOPE GUINESS? [/INST] | SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS' ORDER BY T3.length DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of all the films in the category of "Horror". [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films are there under the category of "Horror"? [/INST] | SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of all the films under the category of "Horror" and has a rental rate of $2.99. [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Horror' AND T1.rental_rate = 2.99; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: For how many times has the customer RUTH MARTINEZ rented a film? [/INST] | SELECT COUNT(T2.rental_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the titles of all the films that the customer RUTH MARTINEZ has rented. [/INST] | SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films that the customer RUTH MARTINEZ has rented, how many of them are released in 2006? [/INST] | SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T4.release_year = 2006 AND T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films that the customer RUTH MARTINEZ has rented, what is the title of the one with the highest replacement cost? [/INST] | SELECT T4.title FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' ORDER BY T4.replacement_cost DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please list the full names of all the customers who have rented the film with the highest replacement cost. [/INST] | SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id ORDER BY T4.replacement_cost DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films rented to the customer RUTH MARTINEZ were returned in August, 2005? [/INST] | SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ' AND STRFTIME('%m',T2.return_date) = '8' AND STRFTIME('%Y', T2.return_date) = '2005'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Please give the full name of the customer that have rented the most films. [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.rental_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the customers who have rented the film ACADEMY DINOSAUR, how many of them are active? [/INST] | SELECT COUNT(T1.customer_id) FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id INNER JOIN inventory AS T3 ON T2.inventory_id = T3.inventory_id INNER JOIN film AS T4 ON T3.film_id = T4.film_id WHERE T1.active = 1 AND T4.title = 'ACADEMY DINOSAUR'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which film is rented for the most times by the customers? Please give its title. [/INST] | SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which customer has rented more movies, RUTH MARTINEZ or LINDA WILLIAMS? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE (T1.first_name = 'RUTH' AND T1.last_name = 'MARTINEZ') OR (T1.first_name = 'LINDA' AND T1.last_name = 'WILLIAMS') GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among all the films starring PENELOPE GUINESS, what is the title of the one with the highest rental price per day? [/INST] | SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS' ORDER BY T3.rental_rate / T3.rental_duration DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average replacement cost of the films under the category of "Horror"? [/INST] | SELECT AVG(T3.replacement_cost) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T2.name = 'Horror'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among all films that the customer RUTH MARTINEZ has rented, what is the percentage of it being a Music film? [/INST] | SELECT CAST(SUM(IIF(T3.name = 'Music', 1, 0)) AS REAL) * 100 / COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id INNER JOIN inventory AS T4 ON T1.film_id = T4.film_id INNER JOIN customer AS T5 ON T4.store_id = T5.store_id INNER JOIN rental AS T6 ON T4.inventory_id = T6.inventory_id WHERE T5.first_name = 'RUTH' AND T5.last_name = 'MARTINEZ'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the average duration time of the films starring PENELOPE GUINESS? [/INST] | SELECT AVG(T3.length) FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'PENELOPE' AND T1.last_name = 'GUINESS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is Diane Collins' email address? [/INST] | SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the number of inactive customers. [/INST] | SELECT COUNT(customer_id) FROM customer WHERE active = 0; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Who is the owner of email address "[email protected]"? Give the full name. [/INST] | SELECT first_name, last_name FROM customer WHERE email = '[email protected]'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the postal code for the address No.65. [/INST] | SELECT postal_code FROM address WHERE address_id = 65; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: State the number of addresses in the Nordrhein-Westfalen district. [/INST] | SELECT COUNT(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the phone number of address No.72? [/INST] | SELECT phone FROM address WHERE address_id = '72'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: State the number of films that are 178 minutes long. [/INST] | SELECT COUNT(film_id) FROM film WHERE length = '178'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Tell the special features of the film Uprising Uptown. [/INST] | SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the description of the film Artist Coldblooded? [/INST] | SELECT description FROM film WHERE title = 'ARTIST COLDBLOODED'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the detailed address for store No.2. [/INST] | SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 2; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which continent is the mother country of Clarksville city in? [/INST] | SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Clarksville'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many actors played a role in the 2006 film whose rental duration is 7 days, rental rate is 4.99 and is 98 minutes duration? [/INST] | SELECT COUNT(T1.actor_id) FROM film_actor AS T1 INNER JOIN film AS T2 ON T1.film_id = T2.film_id WHERE T2.release_year = 2006 AND T2.rental_duration = 7 AND T2.rental_duration = 4.99 AND T2.length = 98; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: The actor Dan Harris played in a 77 minute film with replacement cost of 9.99, what was the rating for that film? [/INST] | SELECT T3.rating FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'DAN' AND T1.last_name = 'HARRIS' AND T3.length = 77 AND T3.replacement_cost = '9.99'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films did actor Daryl Wahlberg appear in? [/INST] | SELECT COUNT(T1.film_id) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id WHERE T2.first_name = 'DARYL' AND T2.last_name = 'WAHLBERG'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Sherri Rhodes rented a film at 12:27:27 on 2005/7/28, when did she/he return that film? [/INST] | SELECT T2.return_date FROM customer AS T1 INNER JOIN rental AS T2 ON T1.customer_id = T2.customer_id WHERE T1.first_name = 'SHERRI' AND T1.last_name = 'RHODES' AND T2.rental_date = '2005-07-28 12:27:27'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the name of the manager staff for store No.1. [/INST] | SELECT T1.first_name, T1.last_name FROM staff AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id WHERE T2.store_id = 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: State the address location of store No.1. [/INST] | SELECT T1.address, T1.address2, T1.district FROM address AS T1 INNER JOIN store AS T2 ON T1.address_id = T2.address_id WHERE T2.store_id = 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Where does the staff Jon Stephens live? [/INST] | SELECT T1.address, T1.address2 FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'Jon' AND T2.last_name = 'Stephens'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many addresses are there in Woodridge city? [/INST] | SELECT COUNT(T1.address_id) FROM address AS T1 INNER JOIN city AS T2 ON T1.city_id = T2.city_id WHERE T2.city = 'Woodridge'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films are in English? [/INST] | SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T2.name = 'English'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the address location of Heather Morris. [/INST] | SELECT T1.address FROM address AS T1 INNER JOIN customer AS T2 ON T1.address_id = T2.address_id WHERE T2.first_name = 'HEATHER' AND T2.last_name = 'MORRIS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the email address of the person who lives in "1411 Lillydale Drive". [/INST] | SELECT T2.email FROM address AS T1 INNER JOIN staff AS T2 ON T1.address_id = T2.address_id WHERE T1.address = '1411 Lillydale Drive'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How much money did the customer No.297 pay for the rental which happened at 12:27:27 on 2005/7/28? [/INST] | SELECT T1.amount FROM payment AS T1 INNER JOIN rental AS T2 ON T1.rental_id = T2.rental_id WHERE T2.rental_date = '2005-07-28 12:27:27' AND T2.customer_id = 297; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Which category does the film Working Microcosmos belong to? [/INST] | SELECT T3.name FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.title = 'WORKING MICROCOSMOS'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the number of documentary films. [/INST] | SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Documentary'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: State the name of the category which has the most number of films. [/INST] | SELECT T.name FROM ( SELECT T2.name, COUNT(T1.film_id) AS num FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id GROUP BY T2.name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Give the name of the film for inventory No.3479. [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.inventory_id = 3479; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the percentage more for the rental payment for store No.2 than store No.1? [/INST] | SELECT CAST((SUM(IIF(T2.store_id = 2, T1.amount, 0)) - SUM(IIF(T2.store_id = 1, T1.amount, 0))) AS REAL) * 100 / SUM(IIF(T2.store_id = 1, T1.amount, 0)) FROM payment AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id INNER JOIN store AS T3 ON T2.store_id = T3.store_id; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many times is the number of Indian cities than Italian cities? [/INST] | SELECT CAST(SUM(IIF(T1.country = 'India', 1, 0)) AS REAL) / SUM(IIF(T1.country = 'Italy', 1, 0)) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many times is the number of films Gina DeGeneres acted in than Penelope Guinness? [/INST] | SELECT CAST(SUM(IIF(T2.first_name = 'GINA' AND T2.last_name = 'DEGENERES', 1, 0)) AS REAL) * 100 / SUM(IIF(T2.first_name = 'PENELOPE' AND T2.last_name = 'GUINESS', 1, 0)) FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: In 2006, how many restricted films were released? [/INST] | SELECT COUNT(film_id) FROM film WHERE rating = 'R' AND release_year = 2006; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many actors starred in the film id 508? [/INST] | SELECT COUNT(actor_id) FROM film_actor WHERE film_id = 508; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the special features for the film "Smoochy Control"? [/INST] | SELECT special_features FROM film WHERE title = 'SMOOCHY CONTROL'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many customers paid over the amount of 10 on August 2005? [/INST] | SELECT COUNT(customer_id) FROM payment WHERE SUBSTR(payment_date, 1, 7) LIKE '2005-08'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: List the names of the films that are more than 180 minutes long. [/INST] | SELECT title FROM film WHERE length > 180; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How much is the total rental payment for the first 10 rentals? [/INST] | SELECT SUM(amount) FROM payment WHERE rental_id BETWEEN 1 AND 10; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the full names of all the active employees? [/INST] | SELECT first_name, last_name FROM staff WHERE active = 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Who is the staff manager in store id 2? [/INST] | SELECT manager_staff_id FROM store WHERE store_id = 2; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many rentals were returned on 5/27/2005? [/INST] | SELECT COUNT(rental_id) FROM rental WHERE rental_date = '2005-05-27'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What are the names of the movies which Laura Brody starred in? [/INST] | SELECT T3.title FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T1.first_name = 'Laura' AND T1.last_name = 'Brody'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: List the name of the films that can only be found in store id 2. [/INST] | SELECT T1.title FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id WHERE T2.store_id = 2; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the full name of the customer who rented movies for 7 consecutive days? [/INST] | SELECT T1.first_name, T1.last_name FROM customer AS T1 INNER JOIN ( SELECT customer_id, COUNT(*) AS num_days FROM ( SELECT *, date(days, '-' || rn || ' day') AS results FROM ( SELECT customer_id, days, row_number() OVER (PARTITION BY customer_id ORDER BY days) AS rn FROM ( SELECT DISTINCT customer_id, date(rental_date) AS days FROM rental ) ) ) GROUP BY customer_id, results HAVING num_days = 7 ) AS T2 ON T1.customer_id = T2.customer_id; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many films are categorized as horror? [/INST] | SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id WHERE T2.name = 'Horror'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the name of the most rented movie? [/INST] | SELECT T.title FROM ( SELECT T1.title, COUNT(T3.rental_id) AS num FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id GROUP BY T1.title ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the most common special features of science-fiction movies? [/INST] | SELECT T1.special_features FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'sci-fi' ORDER BY T1.special_features DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the full name of the actor who starred in most movies? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.film_id) AS num FROM film_actor AS T1 INNER JOIN actor AS T2 ON T1.actor_id = T2.actor_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the films with a rental duration of 7 days, how many are comedies? [/INST] | SELECT COUNT(T1.film_id) FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T1.rental_duration = 7 AND T3.name = 'Comedy'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Who is the staff manager of the store with the most non-active customers? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T3.first_name, T3.last_name, COUNT(T1.customer_id) AS num FROM customer AS T1 INNER JOIN store AS T2 ON T1.store_id = T2.store_id INNER JOIN staff AS T3 ON T2.store_id = T3.store_id WHERE T1.active = 0 GROUP BY T3.first_name, T3.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the rental price per day of the most expensive children's film? [/INST] | SELECT T1.rental_rate FROM film AS T1 INNER JOIN film_category AS T2 ON T1.film_id = T2.film_id INNER JOIN category AS T3 ON T2.category_id = T3.category_id WHERE T3.name = 'Children' ORDER BY T1.rental_rate / T1.rental_duration DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the complete address of store id 1? [/INST] | SELECT T3.address, T3.address2, T3.district FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN store AS T4 ON T3.address_id = T4.address_id WHERE T4.store_id = 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many customers are from the city of Lethbridge? [/INST] | SELECT COUNT(T3.customer_id) FROM city AS T1 INNER JOIN address AS T2 ON T1.city_id = T2.city_id INNER JOIN customer AS T3 ON T2.address_id = T3.address_id WHERE T1.city = 'Lethbridge'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many cities are there in the United States? [/INST] | SELECT COUNT(T2.city) FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T1.country = 'United States'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: List the names of the customers from India. [/INST] | SELECT T4.first_name, T4.last_name FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id INNER JOIN address AS T3 ON T2.city_id = T3.city_id INNER JOIN customer AS T4 ON T3.address_id = T4.address_id WHERE T1.country = 'India'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Among the classic movies, how many movies have a rental rate of less than 1? [/INST] | SELECT COUNT(T1.film_id) FROM film_category AS T1 INNER JOIN category AS T2 ON T1.category_id = T2.category_id INNER JOIN film AS T3 ON T1.film_id = T3.film_id WHERE T3.rental_rate < 1 AND T2.name = 'Classics'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the full name of the customer who rented the highest number of movies of all time? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T2.first_name, T2.last_name, COUNT(T1.rental_id) AS num FROM rental AS T1 INNER JOIN customer AS T2 ON T1.customer_id = T2.customer_id GROUP BY T2.first_name, T2.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: How many times was "Blanket Beverly" rented? [/INST] | SELECT COUNT(T3.rental_id) FROM film AS T1 INNER JOIN inventory AS T2 ON T1.film_id = T2.film_id INNER JOIN rental AS T3 ON T2.inventory_id = T3.inventory_id WHERE T1.title = 'Blanket Beverly'; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: What is the full name of the actor who has the highest number of restricted films? [/INST] | SELECT T.first_name, T.last_name FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id WHERE T3.rating = 'R' GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 1; |
[INST] Here is a database schema:
film_text :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
actor :
actor_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
last_update [ DATETIME ]
address :
address_id [ INTEGER ] primary_key
address [ TEXT ]
address2 [ TEXT ]
district [ TEXT ]
city_id [ INTEGER ]
postal_code [ TEXT ]
phone [ TEXT ]
last_update [ DATETIME ]
category :
category_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
city :
city_id [ INTEGER ] primary_key
city [ TEXT ]
country_id [ INTEGER ]
last_update [ DATETIME ]
country :
country_id [ INTEGER ] primary_key
country [ TEXT ]
last_update [ DATETIME ]
customer :
customer_id [ INTEGER ] primary_key
store_id [ INTEGER ]
first_name [ TEXT ]
last_name [ TEXT ]
email [ TEXT ]
address_id [ INTEGER ]
active [ INTEGER ]
create_date [ DATETIME ]
last_update [ DATETIME ]
film :
film_id [ INTEGER ] primary_key
title [ TEXT ]
description [ TEXT ]
release_year [ TEXT ]
language_id [ INTEGER ]
original_language_id [ INTEGER ]
rental_duration [ INTEGER ]
rental_rate [ REAL ]
length [ INTEGER ]
replacement_cost [ REAL ]
rating [ TEXT ]
special_features [ TEXT ]
last_update [ DATETIME ]
film_actor :
actor_id [ INTEGER ]
film_id [ INTEGER ]
last_update [ DATETIME ]
film_category :
film_id [ INTEGER ]
category_id [ INTEGER ]
last_update [ DATETIME ]
inventory :
inventory_id [ INTEGER ] primary_key
film_id [ INTEGER ]
store_id [ INTEGER ]
last_update [ DATETIME ]
language :
language_id [ INTEGER ] primary_key
name [ TEXT ]
last_update [ DATETIME ]
payment :
payment_id [ INTEGER ] primary_key
customer_id [ INTEGER ]
staff_id [ INTEGER ]
rental_id [ INTEGER ]
amount [ REAL ]
payment_date [ DATETIME ]
last_update [ DATETIME ]
rental :
rental_id [ INTEGER ] primary_key
rental_date [ DATETIME ]
inventory_id [ INTEGER ]
customer_id [ INTEGER ]
return_date [ DATETIME ]
staff_id [ INTEGER ]
last_update [ DATETIME ]
staff :
staff_id [ INTEGER ] primary_key
first_name [ TEXT ]
last_name [ TEXT ]
address_id [ INTEGER ]
picture [ BLOB ]
email [ TEXT ]
store_id [ INTEGER ]
active [ INTEGER ]
username [ TEXT ]
password [ TEXT ]
last_update [ DATETIME ]
store :
store_id [ INTEGER ] primary_key
manager_staff_id [ INTEGER ]
address_id [ INTEGER ]
last_update [ DATETIME ]
Please write me a SQL statement that answers the following question: Who are the top 5 actors with the highest number of films? List their full names and calculate the average number of films for each of the actors. [/INST] | SELECT T.first_name, T.last_name, num FROM ( SELECT T1.first_name, T1.last_name, COUNT(T2.film_id) AS num FROM actor AS T1 INNER JOIN film_actor AS T2 ON T1.actor_id = T2.actor_id INNER JOIN film AS T3 ON T2.film_id = T3.film_id GROUP BY T1.first_name, T1.last_name ) AS T ORDER BY T.num DESC LIMIT 5; |