question
stringlengths
326
2.82k
answer
stringlengths
23
804
db_schema
stringclasses
67 values
db_name
stringclasses
67 values
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: number of bikes that can be borrowed refers to bikes_available; San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; time = '2013/8/29 12:06:01' Question: How many bikes can be borrowed in San Jose Diridon Caltrain Station at 12:06:01 on 2013/8/29?
SELECT T2.bikes_available FROM station AS T1 INNER JOIN status AS T2 ON T1.id = T2.station_id WHERE T1.name = 'San Jose Diridon Caltrain Station' AND T2.time = '2013/08/29 12:06:01'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: bike is borrowed from refers to start_station_id; Question: In which city's station is a bike borrowed on trip ID4069?
SELECT T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: started on the days in September, 2013 refers to date LIKE'9%'AND date LIKE'%2013' hottest temperature over 70 degrees Fahrenheit refers to max_temperature_f>70; Question: How many bike trips started on the days in September, 2013 with the hottest temperature over 70 degrees Fahrenheit in the area where the zip code is 94107?
SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '9/%/2013' AND T2.zip_code = 94107 AND T2.max_temperature_f > 70
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: starting stations refers to start_station_name; day with a max humidity over 80 refers to max_humidity>80; in 2013 refers to date LIKE'%2013'; Question: Please list the starting stations of the bike trips made on a day with a max humidity over 80 in 2013 in the area where the zip code is 94107.
SELECT DISTINCT T1.start_station_name FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE SUBSTR(CAST(T2.date AS TEXT), -4) = '2013' AND T2.zip_code = 94107 AND T2.max_temperature_f > 80
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: subscriber refers to subscription_type = 'Subscriber'; in August 2013 refers to start_date LIKE'8%' AND start_date LIKE'%2013%'; station that can hold more than 20 bikes refers to dock_count>20; Question: How many trips made by a subscriber started in August, 2013 from a station that can hold more than 20 bikes?
SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T1.id = T2.start_station_id WHERE T2.subscription_type = 'Subscriber' AND T2.start_date LIKE '8/%/2013%' AND T1.dock_count > 20
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: location coordinates refers to (lat, long); bike that was borrowed the longest refers to MAX(duration); Question: What is the location coordinates of the bike station from which the bike for the trip that last the longest was borrowed?
SELECT T2.lat, T2.long FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.duration = ( SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name )
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: end station refers to end_station_id; docks that were left refers to docks_available; Question: How many docks were left at the end station for trip ID4069?
SELECT SUM(T2.docks_available) FROM trip AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.end_station_id WHERE T1.ID = 4069
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: started on the days with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013'; started from station refers to start_station_name; start_station_name = '2nd at Townsend'; Question: Among the bike trips started on the days with a fog in 2013, how many of those trips started from the station "2nd at Townsend"?
SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T1.start_station_name = '2nd at Townsend' AND T2.zip_code = 94107
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: longest duration refers to MAX(duration); starting on a day with a fog refers to start_date where events = 'fog'; in 2013 refers to date LIKE '%2013'; Question: What is the longest duration for a bike trip starting on a day with a fog in 2013?
SELECT MAX(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2013%' AND T2.events = 'Fog' AND T2.zip_code = 94107
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: bike was borrowed from refers to start_station_id; when the bike station was installed refers to installation_date; Question: When was the bike station from which the bike was borrowed on trip ID4069 installed?
SELECT T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 4069
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: bike was borrowed from refers to start_station_id; San Francisco refers to city = 'San Francisco'; subscriber refers to subscription_type = 'Subscriber'; Question: How many trips with a bike borrowed from the stations in San Francisco were made by a subscriber?
SELECT COUNT(T1.id) FROM trip AS T1 INNER JOIN station AS T2 ON T2.ID = T1.start_station_id WHERE T2.city = 'San Francisco' AND T1.subscription_type = 'Subscriber'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: hottest temperature refers to max_temperatutre_f; in 2014 refers to date LIKE '%2014'; started from station refers to start_station_name; start_station_name = '2nd at Folsom'; Question: On the day with the hottest temperature ever in 2014, how many bike trips started from the station 2nd at Folsom?
SELECT COUNT(T1.start_station_name) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T2.zip_code = 94107 AND T1.start_station_name = '2nd at Folsom' ORDER BY T2.max_temperature_f DESC LIMIT 1
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: average duration = DIVIDE(SUM(duration), COUNT(id)); hottest temperature refers to max_temperature_f; in 2014 refers to date LIKE '%2014'; Question: What is the average duration of a bike trip made on the day with the hottest temperature ever in 2014?
SELECT AVG(T1.duration) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T2.date LIKE '%2014%' AND T1.start_station_name = '2nd at Folsom' AND T2.max_temperature_f = ( SELECT max_temperature_f FROM weather ORDER BY max_temperature_f DESC LIMIT 1 )
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: end station refers to end_station_name; starting from refers to start_station_name; start_station_name = '2nd at South Park'; Question: List out all end stations for a bicycle that were making a trip starting from 2nd at South Park station? Only retain the unique value.
SELECT DISTINCT end_station_name FROM trip WHERE start_station_name = '2nd at South Park'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: rainy days refers to events = 'rain'; Mountain View refers to zip_code = 94041; Question: How many rainy days were recorded in Mountain View?
SELECT SUM(IIF(zip_code = 94041 AND events = 'Rain', 1, 0)) FROM weather
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: total number of bikes that can be hold = MAX(dock_count); before 2014 refers to year(installation_date)<2014; Question: What is the total number of bikes that can be hold in Redwood City before 2014.
SELECT SUM(CASE WHEN city = 'Redwood City' AND SUBSTR(installation_date, -4) < '2014' THEN dock_count ELSE 0 END) NUM FROM station
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: longest trip duration refers to MAX(duration); days conversion = DIVIDE(duration, 86400); Question: What is the longest trip duration according? Convert the it to number of days.
SELECT MAX(duration), CAST(MAX(duration) AS REAL) / 86400 FROM trip
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: temperature refers to max_temperature_f; March 2013 refers to date like '3/%/2013'; conversion to Celcius = DIVIDE(SUBTRACT(max_temperature_f, 32), 1.800) as Celsius1; DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.800) as Celsius2; DIVIDE(SUBTRACT(min_temperature_f, 32), 1.800) as Celcius3; Question: Convert all temperature recorded at San Francisco city during August 2013 into degree Celsius.
SELECT (max_temperature_f - 32) / 1.8000 , (mean_temperature_f - 32) / 1.8000 , (min_temperature_f - 32) / 1.8000 FROM weather WHERE SUBSTR(CAST(date AS TEXT), 1, INSTR(date, '/') - 1) = '8' AND SUBSTR(CAST(date AS TEXT), -4) = '2013' AND zip_code = 94107
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: subscriber refers to subscription_type = 'Subscriber'; customer refers to subscription_type = 'customer';starting station refers to start_station_name; ending station refers to end_statio_name; start_station_name = '2nd at South Park' AND end_station_name = '2nd at South Park' Question: What is the ratio for subscriber to customer given that the starting and the ending stations is 2nd at South Park?
SELECT CAST(SUM(IIF(subscription_type = 'Subscriber', 1, 0)) AS REAL) / SUM(IIF(subscription_type = 'Customer', 1, 0)) FROM trip WHERE start_station_name = '2nd at South Park' AND end_station_name = '2nd at South Park'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: station refers to name; Question: Are all stations with zip code 94107 located in San Francisco city?
SELECT DISTINCT T2.city FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.zip_code = 94107
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: mean temperature refers to mean_temperature_f; mean temperature of 20 degree Celsius refers to DIVIDE(SUBTRACT(mean_temperature_f, 32), 1.8) = 20; in 2014 refers to date LIKE'%2015%'; Question: List out all stations name that having a mean temperature 20 degree Celsius in year 2014.
SELECT DISTINCT T2.start_station_name, T2.end_station_name FROM weather AS T1 INNER JOIN trip AS T2 ON T1.zip_code = T2.zip_code WHERE T1.date LIKE '%2014' AND T1.mean_temperature_f = 20 * 1.8 + 32
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: during August 2013 refers to start_date like '8/%/2013%'; Question: How many bicycle trip were made within San Jose city during August 2013?
SELECT COUNT(T2.id) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.city = 'San Jose' AND T2.start_date LIKE '8/%/2013%' AND T2.start_station_name LIKE 'San Jose%' AND T2.end_station_name LIKE 'San Jose%'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: intercity trip refers to start_station_name! = end_station_name; during 2014 refers to start_date like '%2014%'; start station refers to start_station_name; end station refers to end_station_name; Question: Is there any intercity trip were made during 2014? If yes, list out the city name for the start and end station.
SELECT T1.start_station_name, T1.end_station_name FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.start_date LIKE '%/%/2014%' AND T1.start_station_name != T1.end_station_name
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: intercity trip refers to start_station_name! = end_station_name; total travel duration to hour = DIVIDE(SUM(duration), 3600) AS hour; Question: Does the bike with Id number 16 making any intercity trip? If yes, calculate the total travel duration during all the intercity trip. Convert the duration to hour.
SELECT T1.end_station_name, T2.city, CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.bike_id = 16 AND T1.start_station_name != T1.end_station_name
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; ratio = MULTIPLY(DIVIDE(COUNT(subscription_type = 'Customer'), COUNT(subscription_type = 'Subscriber'). 1.0)) AS ratio; Question: What is the ratio of customer to subscriber that making a trip inside Mountain View city?
SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Mountain View'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: total trip duration to hour = DIVIDE(SUM(duration), 3600); Question: What is the total trip duration made within Palo Alto city? Convert the duration to hour.
SELECT CAST(SUM(T1.duration) AS REAL) / 3600 FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'Palo Alto'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: least used bike refers to bike_id with MIN(COUNT(main_trip.id)); start station refers to start_station_name; end station refers to end_station_name; total duration in hour = DIVIDE(duration, 3600) AS hour; Question: Which bicycle is the least used bike. Check if the start and end station are from the same city and calculate the total duration travelled by the bicycle in hours for a trip made within the same city.
SELECT T2.bike_id, T2.start_station_name, T2.end_station_name, T1.city , CAST(T2.duration AS REAL) / 3600 FROM station AS T1 INNER JOIN trip AS T2 ON T1.name = T2.start_station_name GROUP BY T2.bike_id ORDER BY COUNT(T2.id) DESC LIMIT 1
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: subsscriber refers to subscription_type = subscriber; started their trips in refers to start_station_name; start_station_name = 'Market at 4th'; Question: Count the number of subscribers who started their trips in Market at 4th.
SELECT COUNT(CASE WHEN subscription_type = 'Subscriber' AND start_station_name = 'Market at 4th' THEN id END) FROM trip
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: Mountain View refers to city = 'Mountain View'; installed on 12/31/2013 refers to installation_date = '12/31/2013'; Question: List the names of the stations within Mountain View that were installed on 12/31/2013.
SELECT name FROM station WHERE installation_date = '12/31/2013' AND city = 'Mountain View'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: Townsend at 7th Station refers to city = 'Townsend at 7th Station'; number of bikes a station can hold refers to SUM(dock_count); Question: Which city is Townsend at 7th Station located and how many bikes could it hold?
SELECT city, SUM(dock_count) FROM station WHERE name = 'Townsend at 7th'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: number of bikes a station can hold refers to SUM(dock_count); Evelyn Park and Ride refers to name = 'Evelyn Park and Ride'; started on the station refers to start_station_name; subscribers refers to subscription_type = 'subscriber'; Question: How many bikes could Evelyn Park and Ride hold and how many users who started on that station are subscribers?
SELECT SUM(T2.dock_count), COUNT(T1.subscription_type) FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.name = 'Evelyn Park and Ride' AND T1.start_station_name = T2.name AND T1.subscription_type = 'Subscriber'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: hottest temperature refers to MAX(max_temperature_f); Question: How many subscribers are in the zip code of 94301 and what is the hottest temperature recorded on that zip code?
SELECT COUNT(T3.zip_code), T3.max_temperature_f FROM trip AS T2 INNER JOIN weather AS T3 ON T3.zip_code = T2.zip_code WHERE T3.zip_code = 94301 AND T2.subscription_type = 'Subscriber' ORDER BY T3.max_temperature_f DESC LIMIT 1
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: customer refers to subscription_type = 'customer'; subscriber refers to subscription_type = 'subscriber'; started their trips within refers to start_station_id; percentage ratio = DIVIDE(SUM(subscription_type = 'Customer'), SUM(subscription_type = 'Subscriber')) as percentage; Question: What is the percentage ration of customers to subscribers that started their trips within the city of San Francisco?
SELECT CAST(SUM(CASE WHEN T1.subscription_type = 'Customer' THEN 1 ELSE 0 END) AS REAL) * 100 / SUM(CASE WHEN T1.subscription_type = 'Subscriber' THEN 1 ELSE 0 END) FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T2.city = 'San Francisco'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: average duration = DIVIDE(SUM(duration), COUNT(id)); starting station refers to start_station_name; start_station_name = 'Santa Clara at Almaden'; latitude refers to lat; longitude refers to long; Question: What is the average duration of trips for the starting station of Santa Clara at Almaden and what is the latitude and longitude of this station?
SELECT AVG(T1.duration), T2.lat, T2.long FROM trip AS T1 LEFT JOIN station AS T2 ON T2.name = T1.start_station_name LEFT JOIN station AS T3 ON T3.name = T1.end_station_name WHERE T1.start_station_name = 'Santa Clara at Almaden'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: shortest trip refers to MIN(duration); starting from refers to start_station_name; start_station_name = 'Franklin at Maple'; maximum wind speed refers to max_wind_Speed_mph; Question: What is the shortest trip made starting from Franklin at Maple and what is the maximum wind speed at that date?
SELECT MIN(T1.duration), MAX(T2.max_wind_Speed_mph) FROM trip AS T1 INNER JOIN weather AS T2 ON T2.zip_code = T1.zip_code WHERE T1.start_station_name = 'Franklin at Maple' AND T2.date = '9/4/2013'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: number of bikes that have been borrowed refers to SUM(bikes_available); San Jose Diridon Caltrain Station refers to name = 'San Jose Diridon Caltrain Station'; station's coordinates refers to (lat, long); Question: How many bikes have been borrowed at San Jose Diridon Caltrain Station on the date and time of 10/20/2013 8:11:01 AM and indicate the station's coordinates.
SELECT SUM(T2.bikes_available), T1.long, T1.lat FROM station AS T1 INNER JOIN status AS T2 ON T2.station_id = T1.id WHERE T2.time = '2013/10/20 8:11:01' AND T1.name = 'San Jose Diridon Caltrain Station'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: when the station was first installed refers to installation_date; Question: Name the city of the station that trip ID 585842 borrowed a bike and indicate when that station was first installed.
SELECT T2.city, T2.installation_date FROM trip AS T1 INNER JOIN station AS T2 ON T2.name = T1.start_station_name WHERE T1.id = 585842
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: installed on refers to installation_date; installation_date = '8/16/2013'; customers refers to subscription_type = customers; Question: How many stations were installed on the date of 8/16/2013 and how many users on those stations are classified as a customer?
SELECT COUNT(T1.name) , SUM(CASE WHEN T2.subscription_type = 'Customer' THEN 1 ELSE 0 END) FROM station AS T1 INNER JOIN trip AS T2 ON T2.start_station_name = T1.name WHERE T1.installation_date = '8/16/2013' AND T2.subscription_type = 'Customer'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: started at refers to start_station_name; start_station_name = 'Market at 4th'; location coordinates refers to (lat, long); Question: Which station did the user who started at Market at 4th station ended their trip at the time of 12:45:00 PM and the date of 8/29/2013 and what is the location coordinates of the ending station?
SELECT T1.name, T1.lat, T1.long FROM station AS T1 INNER JOIN trip AS T2 ON T2.end_station_name = T1.name WHERE T2.start_station_name = 'Market at 4th' AND T2.end_date = '8/29/2013 12:45'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: subscribers refers to subscription_type = 'subscribers'; ended their trip at refers to end_station_name; end_station_name = 'MLK Library'; number of docks a station have refers to dock_count; Question: How many subscribers have ended their trip at MLK Library and how many docks does that station have?
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
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: coldest temperature refers to min_temperature_f; average coldest temperature refers = AVG(min_temperature_f); stations refers to name; latitude refers to lat; longitude refers to long; 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.
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
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table station, columns = [id,name,lat,long,dock_count,city,installation_date] Table status, columns = [station_id,bikes_available,docks_available,time] Table trip, columns = [id,duration,start_date,start_station_name,start_station_id,end_date,end_station_name,end_station_id,bike_id,subscription_type,zip_code] Table weather, columns = [*,date,max_temperature_f,mean_temperature_f,min_temperature_f,max_dew_point_f,mean_dew_point_f,min_dew_point_f,max_humidity,mean_humidity,min_humidity,max_sea_level_pressure_inches,mean_sea_level_pressure_inches,min_sea_level_pressure_inches,max_visibility_miles,mean_visibility_miles,min_visibility_miles,max_wind_Speed_mph,mean_wind_speed_mph,max_gust_speed_mph,precipitation_inches,cloud_cover,events,wind_dir_degrees,zip_code] Foreign_keys = [] Knowledge: average duration = DIVIDE(SUM(duration), COUNT(id)); subscribers refers to subscription_type = 'subscriptions'; started and ended their trip at Mountain View City Hall refers to start_station_name = 'Mountain View City Hall' and end_station_name = 'Mountain View City Hall'; when the station was first installed refers to installation_date; 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.
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'
{'station': ['id', 'name', 'lat', 'long', 'dock_count', 'city', 'installation_date'], 'status': ['station_id', 'bikes_available', 'docks_available', 'time'], 'trip': ['id', 'duration', 'start_date', 'start_station_name', 'start_station_id', 'end_date', 'end_station_name', 'end_station_id', 'bike_id', 'subscription_type', 'zip_code'], 'weather': ['date', 'max_temperature_f', 'mean_temperature_f', 'min_temperature_f', 'max_dew_point_f', 'mean_dew_point_f', 'min_dew_point_f', 'max_humidity', 'mean_humidity', 'min_humidity', 'max_sea_level_pressure_inches', 'mean_sea_level_pressure_inches', 'min_sea_level_pressure_inches', 'max_visibility_miles', 'mean_visibility_miles', 'min_visibility_miles', 'max_wind_Speed_mph', 'mean_wind_speed_mph', 'max_gust_speed_mph', 'precipitation_inches', 'cloud_cover', 'events', 'wind_dir_degrees', 'zip_code']}
bike_share_1
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "ACADEMY DINOSAUR" is the title of film Question: What is the description of the film ACADEMY DINOSAUR?
SELECT description FROM film WHERE title = 'ACADEMY DINOSAUR'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: rental duration of over 6 days refers to rental_duration > 6 Question: How many films have a rental duration of over 6 days?
SELECT COUNT(film_id) FROM film WHERE rental_duration > 6
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: released in 2006 refers to release_year = 2006; rental rate of $2.99 refers to rental_rate = 2.99 Question: Please list the titles of the films that are released in 2006 and have a rental rate of $2.99.
SELECT title FROM film WHERE release_year = 2006 AND rental_rate = 2.99
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: longest duration of film refers to Max(length) Question: Which film has the longest duration of film screening? Please give its title.
SELECT title FROM film ORDER BY length DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: higher replacement cost refers to Max(replacement_cost); 'ACE GOLDFIINGER' and 'ACADEMY DINOSAUR' are both the title of film Question: Which film has a higher replacement cost, ACE GOLDFINGER or ACADEMY DINOSAUR?
SELECT title FROM film WHERE title IN ('ACE GOLDFINGER', 'ACADEMY DINOSAUR') ORDER BY replacement_cost DESC LIMIT 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: released in 2006 refers to release_year = 2006; rated Adults Only refers to rating = 'NC-17' Question: Among the films that are released in 2006, how many of them are rated Adults Only in the Motion Picture Association Film Rating?
SELECT COUNT(film_id) FROM film WHERE rating = 'NC-17' AND release_year = 2006
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: rental rate of $2.99 refers to rental_rate = 2.99; film refers to title Question: How many films with the rental rate of $2.99 have the special feature of "Deleted Scenes"?
SELECT COUNT(film_id) FROM film WHERE rental_rate = 2.99 AND special_features = 'Deleted Scenes'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: more than 2 special features refers to Count(special_features) > 2 Question: Please list the titles of all the films that have more than 2 special features.
SELECT title FROM ( SELECT title, COUNT(special_features) AS num FROM film GROUP BY title ) AS T ORDER BY T.num > 2
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: What is the email address of the staff Jon Stephens?
SELECT email FROM staff WHERE first_name = 'Jon' AND last_name = 'Stephens'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; active staff refers to active = 1 Question: Please give the full names of all the active staff.
SELECT first_name, last_name FROM staff WHERE active = 1
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest replacement_cost refers to Max (replacement_cost); year refers to release_year Question: In which year was the film with the highest replacement cost released?
SELECT DISTINCT release_year FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film )
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest replacement_cost refers to Max (replacement_cost); film refers to title Question: Please list the titles of the top 3 films with the highest replacement cost.
SELECT title FROM film WHERE replacement_cost = ( SELECT MAX(replacement_cost) FROM film ) LIMIT 3
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "ACADEMY DINOSAUR" is the title of film; language refers to language.name Question: What is the language of the film ACADEMY DINOSAUR?
SELECT T2.name FROM film AS T1 INNER JOIN language AS T2 ON T1.language_id = T2.language_id WHERE T1.title = 'ACADEMY DINOSAUR'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "English" is the name of language Question: How many films are in English?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Please list the titles of all the films starring the actor PENELOPE GUINESS.
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "ACADEMY DINOSAUR" is the title of film Question: How many actors have starred in the film ACADEMY DINOSAUR?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; "ACADEMY DINOSAUR" is the title of film Question: Please list the full names of all the actors that have starred in the film ACADEMY DINOSAUR.
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: release in 2006 refers to release_year = 2006; Question: Among the films starring PENELOPE GUINESS, how many of them are released in 2006?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest replacement cost refers to Max (replacement_cost) Question: Please give the title of the film starring PENELOPE GUINESS and has the highest replacement cost.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest replacement cost refers to Max (replacement_cost); full name refers to first_name, last_name Question: Please list the full names of all the actors that have starred in the film with the highest replacement cost.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "English" is the name of language Question: Among the films starring PENELOPE GUINESS, how many of them are in English?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: longest duration of film refers to Max(length) Question: What is the title of the film with the longest duration time and stars PENELOPE GUINESS?
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Horror" is the name of category Question: Please list the titles of all the films in the category of "Horror".
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Horror" is the name of category Question: How many films are there under the category of "Horror"?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Horror" is the name of category; rental rate of $2.99 refers to rental_rate = 2.99 Question: Please list the titles of all the films under the category of "Horror" and has a rental rate of $2.99.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: times of rented refers to Count(rental_id) Question: For how many times has the customer RUTH MARTINEZ rented a film?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: Please list the titles of all the films that the customer RUTH MARTINEZ has rented.
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: release in 2006 refers to release_year = 2006 Question: Among the films that the customer RUTH MARTINEZ has rented, how many of them are released in 2006?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest replacement cost refers to Max(replacement_cost) Question: Among the films that the customer RUTH MARTINEZ has rented, what is the title of the one with the highest replacement cost?
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; highest replacement cost refers to Max(replacement_cost) Question: Please list the full names of all the customers who have rented the film with the highest replacement cost.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: returned in August, 2005 refers to year(return_date) = 2005 and month (return_date) = 8 Question: How many films rented to the customer RUTH MARTINEZ were returned in August, 2005?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: full name refers to first_name, last_name; customer who rented the most film refers to Max(count(rental_id)) Question: Please give the full name of the customer that have rented the most films.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "ACADEMY DINOSAUR" is the title of film; customer refers to customer_id; active refers to active = 1 Question: Among the customers who have rented the film ACADEMY DINOSAUR, how many of them are active?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: film refers to title; film rented the most times refers to title where Max(Count(rental_id)) Question: Which film is rented for the most times by the customers? Please give its title.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: rented more movie Max(Count(customer_id)); "RUTH MARTINEZ" and "LINDA WILLIAMS" are both full name of customer Question: Which customer has rented more movies, RUTH MARTINEZ or LINDA WILLIAMS?
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: highest rental price per day refers to Max(Divide(rental_rate, rental_duration)) Question: Among all the films starring PENELOPE GUINESS, what is the title of the one with the highest rental price per day?
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Horror" is the name of category; average replacement cost = Divide (Sum(replacement_cost), Count(film_id where name = Horror)) Question: What is the average replacement cost of the films under the category of "Horror"?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: music film refers to name = 'Music'; percentage = Divide (Count(film_id where name = 'Music'), Count(film_id)) * 100 Question: Among all films that the customer RUTH MARTINEZ has rented, what is the percentage of it being a Music film?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: average duration time = AVG(length) Question: What is the average duration time of the films starring PENELOPE GUINESS?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: What is Diane Collins' email address?
SELECT email FROM customer WHERE first_name = 'DIANE' AND last_name = 'COLLINS'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: inactive refers to active = 0 Question: Give the number of inactive customers.
SELECT COUNT(customer_id) FROM customer WHERE active = 0
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "JEREMY.HURTADO@sakilacustomer.org" is the email; owner refers to customer; full name refers to first_name, last_name Question: Who is the owner of email address "JEREMY.HURTADO@sakilacustomer.org"? Give the full name.
SELECT first_name, last_name FROM customer WHERE email = 'JEREMY.HURTADO@sakilacustomer.org'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: address no. 65 refers to address_id = 65 Question: Give the postal code for the address No.65.
SELECT postal_code FROM address WHERE address_id = 65
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: number of address refers to address_id Question: State the number of addresses in the Nordrhein-Westfalen district.
SELECT COUNT(address_id) FROM address WHERE district = 'Nordrhein-Westfalen'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: address no. 72 refers to address_id = 72; phone number refers to phone Question: What is the phone number of address No.72?
SELECT phone FROM address WHERE address_id = '72'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: 178 min long refers to length = '178' Question: State the number of films that are 178 minutes long.
SELECT COUNT(film_id) FROM film WHERE length = '178'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "UPRISING UPTOWN" is the title of film Question: Tell the special features of the film Uprising Uptown.
SELECT special_features FROM film WHERE title = 'UPRISING UPTOWN'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "ARTIST COLDBLOODED" is the title of film Question: What is the description of the film Artist Coldblooded?
SELECT description FROM film WHERE title = 'ARTIST COLDBLOODED'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: store no. 22 refers to store_id = 2; detailed address refers to address, address2, district Question: Give the detailed address for store No.2.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Clarksville" is the city; Question: Which continent is the mother country of Clarksville city in?
SELECT T1.country FROM country AS T1 INNER JOIN city AS T2 ON T1.country_id = T2.country_id WHERE T2.city = 'Clarksville'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: in 2006 refers to release_year = 2006; 98 min duration refers to length = 98; number of actors refers to count(actor_id) 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?
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: 77 min film refers to length = 77 Question: The actor Dan Harris played in a 77 minute film with replacement cost of 9.99, what was the rating for that film?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: Question: How many films did actor Daryl Wahlberg appear in?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: rented at 12:27:27 on 2005/7/28 refers to rental_date = '2005-07-28 12:27:27' Question: Sherri Rhodes rented a film at 12:27:27 on 2005/7/28, when did she/he return that film?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: store no. 1 refers to store_id = 1; name refers to first_name, last_name Question: Give the name of the manager staff for store No.1.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: store no. 1 refers to store_id = 1; address location refers to address, address2, district Question: State the address location of store No.1.
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
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: location refers to address, address2, district Question: Where does the staff Jon Stephens live?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3
Given the following database schema and relevant knowledge, use SQL to answer the question. Schema: Table actor, columns = [actor_id,first_name,last_name,last_update] Table address, columns = [address_id,address,address2,district,city_id,postal_code,phone,last_update] Table category, columns = [category_id,name,last_update] Table city, columns = [city_id,city,country_id,last_update] Table country, columns = [country_id,country,last_update] Table customer, columns = [customer_id,store_id,first_name,last_name,email,address_id,active,create_date,last_update] Table film, columns = [film_id,title,description,release_year,language_id,original_language_id,rental_duration,rental_rate,length,replacement_cost,rating,special_features,last_update] Table film_actor, columns = [actor_id,film_id,last_update] Table film_category, columns = [film_id,category_id,last_update] Table film_text, columns = [film_id,title,description] Table inventory, columns = [inventory_id,film_id,store_id,last_update] Table language, columns = [language_id,name,last_update] Table payment, columns = [payment_id,customer_id,staff_id,rental_id,amount,payment_date,last_update] Table rental, columns = [rental_id,rental_date,inventory_id,customer_id,return_date,staff_id,last_update] Table staff, columns = [staff_id,first_name,last_name,address_id,picture,email,store_id,active,username,password,last_update] Table store, columns = [*,store_id,manager_staff_id,address_id,last_update] Foreign_keys = [] Knowledge: "Woodridge" is the city Question: How many addresses are there in Woodridge city?
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'
{'film_text': ['film_id', 'title', 'description'], 'actor': ['actor_id', 'first_name', 'last_name', 'last_update'], 'address': ['address_id', 'address', 'address2', 'district', 'city_id', 'postal_code', 'phone', 'last_update'], 'category': ['category_id', 'name', 'last_update'], 'city': ['city_id', 'city', 'country_id', 'last_update'], 'country': ['country_id', 'country', 'last_update'], 'customer': ['customer_id', 'store_id', 'first_name', 'last_name', 'email', 'address_id', 'active', 'create_date', 'last_update'], 'film': ['film_id', 'title', 'description', 'release_year', 'language_id', 'original_language_id', 'rental_duration', 'rental_rate', 'length', 'replacement_cost', 'rating', 'special_features', 'last_update'], 'film_actor': ['actor_id', 'film_id', 'last_update'], 'film_category': ['film_id', 'category_id', 'last_update'], 'inventory': ['inventory_id', 'film_id', 'store_id', 'last_update'], 'language': ['language_id', 'name', 'last_update'], 'payment': ['payment_id', 'customer_id', 'staff_id', 'rental_id', 'amount', 'payment_date', 'last_update'], 'rental': ['rental_id', 'rental_date', 'inventory_id', 'customer_id', 'return_date', 'staff_id', 'last_update'], 'staff': ['staff_id', 'first_name', 'last_name', 'address_id', 'picture', 'email', 'store_id', 'active', 'username', 'password', 'last_update'], 'store': ['store_id', 'manager_staff_id', 'address_id', 'last_update']}
movie_3