input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: What are the issues of the complains of male clients and products from age 25 and below? [/INST]
SELECT DISTINCT T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.sex = 'Male' AND T1.age < 25;
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: Among the reviews from midwest region, what are the products that received 1 star? [/INST]
SELECT DISTINCT T3.Product FROM state AS T1 INNER JOIN district AS T2 ON T1.StateCode = T2.state_abbrev INNER JOIN reviews AS T3 ON T2.district_id = T3.district_id WHERE T1.Region = 'Midwest' AND T3.Stars = 1;
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: List the products involved in the complaints received on March 2017 via TOVA server. [/INST]
SELECT DISTINCT T2.Product FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T1.server = 'TOVA' AND T2.`Date received` LIKE '2017-03%';
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: What is the division of the review of 5 stars received on December 17, 2017 for the product Eagle National Mortgage? [/INST]
SELECT T1.division FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Stars = 5 AND T2.Date = '2017-12-17' AND T2.Product = 'Eagle National Mortgage';
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: In complaints about the credit card product, list the phone number of the oldest client. [/INST]
SELECT T1.phone FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T2.Product = 'Credit card' ORDER BY T1.age DESC LIMIT 1;
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: In complaints received in 2014, how many of them were submitted via call? [/INST]
SELECT COUNT(T2.`Complaint ID`) FROM callcenterlogs AS T1 INNER JOIN events AS T2 ON T1.`Complaint ID` = T2.`Complaint ID` WHERE T2.`Submitted via` = 'Phone' AND strftime('%Y', T1.`Date received`) = '2014';
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: List the product and its issues of the complains of clients with age greater than the 60% of average age of all clients. [/INST]
SELECT DISTINCT T2.Product, T2.Issue FROM client AS T1 INNER JOIN events AS T2 ON T1.client_id = T2.Client_ID WHERE T1.age * 100 > ( SELECT AVG(age) * 60 FROM client );
[INST] Here is a database schema: state : StateCode [ TEXT ] primary_key State [ TEXT ] Region [ TEXT ] callcenterlogs : Date received [ DATE ] Complaint ID [ TEXT ] primary_key rand client [ TEXT ] callcenterlogs.rand client = client.client_id phonefinal [ TEXT ] vru+line [ TEXT ] call_id [ INTEGER ] priority [ INTEGER ] type [ TEXT ] outcome [ TEXT ] server [ TEXT ] ser_start [ TEXT ] ser_exit [ TEXT ] ser_time [ TEXT ] client : client_id [ TEXT ] primary_key sex [ TEXT ] day [ INTEGER ] month [ INTEGER ] year [ INTEGER ] age [ INTEGER ] social [ TEXT ] first [ TEXT ] middle [ TEXT ] last [ TEXT ] phone [ TEXT ] email [ TEXT ] address_1 [ TEXT ] address_2 [ TEXT ] city [ TEXT ] state [ TEXT ] zipcode [ INTEGER ] district_id [ INTEGER ] client.district_id = district.district_id district : district_id [ INTEGER ] primary_key city [ TEXT ] state_abbrev [ TEXT ] district.state_abbrev = state.StateCode division [ TEXT ] events : Date received [ DATE ] Product [ TEXT ] Sub-product [ TEXT ] Issue [ TEXT ] Sub-issue [ TEXT ] Consumer complaint narrative [ TEXT ] Tags [ TEXT ] Consumer consent provided? [ TEXT ] Submitted via [ TEXT ] Date sent to company [ TEXT ] Company response to consumer [ TEXT ] Timely response? [ TEXT ] Consumer disputed? [ TEXT ] Complaint ID [ TEXT ] events.Complaint ID = callcenterlogs.Complaint ID Client_ID [ TEXT ] events.Client_ID = client.client_id reviews : Date [ DATE ] primary_key Stars [ INTEGER ] Reviews [ TEXT ] Product [ TEXT ] district_id [ INTEGER ] reviews.district_id = district.district_id Please write me a SQL statement that answers the following question: In reviews of product with 5 stars, what is the percentage of the reviews coming from the division of East North Central? [/INST]
SELECT CAST(SUM(CASE WHEN T1.division = 'East North Central' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T1.division) FROM district AS T1 INNER JOIN reviews AS T2 ON T1.district_id = T2.district_id WHERE T2.Stars = 5;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the names of the production company of the movie "Four Rooms". [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many production companies does the movie "Four Rooms" have? [/INST]
SELECT COUNT(CNAME) FROM ( SELECT T1.company_name AS CNAME FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Four Rooms' );
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the titles of all the movie produced by production company "Universal Pictures". [/INST]
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of the latest released movie produced by production company "Universal Pictures"? [/INST]
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Universal Pictures' ORDER BY T3.release_date DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the name of the director of photography of the movie "Pirates of the Caribbean: At World's End"? [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Director of Photography';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What was the job of Dariusz Wolski in the movie "Pirates of the Caribbean: At World's End"? [/INST]
SELECT T2.job FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T3.person_name = 'Dariusz Wolski';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the names of all the crew members of the movie "Pirates of the Caribbean: At World's End". [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many crew members worked as producer in the movie "Pirates of the Caribbean: At World's End"? [/INST]
SELECT COUNT(T3.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Please list the names of all the producers in the movie "Pirates of the Caribbean: At World's End". [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title LIKE 'Pirates of the Caribbean: At World%s End' AND T2.job = 'Producer';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: In how many movie does Dariusz Wolski work as the director of photography? [/INST]
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Among the movie in which Dariusz Wolski works as the director of photography, what is the title of the one with the highest average vote? [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography' ORDER BY T1.vote_average DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: When was the release date of the latest movie in which Dariusz Wolski worked as a crew member? [/INST]
SELECT T1.release_date FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' ORDER BY T1.release_date DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Among the movie in which Dariusz Wolski works as the director of photography, what is the percentage of those movie whose vote average is over 5.0? [/INST]
SELECT CAST(COUNT(CASE WHEN T1.vote_average > 5 THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T1.vote_average) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the average revenue of the movie in which Dariusz Wolski works as the director of photography? [/INST]
SELECT CAST(SUM(T1.revenue) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Dariusz Wolski' AND T2.job = 'Director of Photography';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Give the name of the movie with a revenue of 559852396. [/INST]
SELECT title FROM movie WHERE revenue = 559852396;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What was David Rubin's job in the movie "Days of Thunder"? [/INST]
SELECT T2.job FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'David Rubin' AND T1.title = 'Days of Thunder';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many movies were directed by Michael Bay? [/INST]
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_crew AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Michael Bay' AND T2.job = 'Director';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Show the total number of keywords of the movie "I Hope They Serve Beer in Hell". [/INST]
SELECT COUNT(T2.keyword_id) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'I Hope They Serve Beer in Hell';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: For the movie "Land of the Dead", who is its director? [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Land of the Dead' AND T2.job = 'Director';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Tell the number of movies made by Paramount Animation. [/INST]
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Paramount Animation';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many female characters are there in the movie "Spider-Man 3"? [/INST]
SELECT COUNT(*) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Spider-Man 3' AND T3.gender = 'Female';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the most used keyword in the movies. [/INST]
SELECT T1.keyword_name FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id GROUP BY T1.keyword_name ORDER BY COUNT(T1.keyword_name) DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many producers does the movie "The Amityville Horror" have? [/INST]
SELECT COUNT(T2.person_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Amityville Horror' AND T2.job = 'Producer';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the production company of the movie "Crazy Heart"? [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Crazy Heart';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Give the number of movies with "saving the world" as the keyword. [/INST]
SELECT COUNT(T2.movie_id) FROM keyword AS T1 INNER JOIN movie_keywords AS T2 ON T1.keyword_id = T2.keyword_id WHERE keyword_name = 'saving the world';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: For all the movies which were produced by Cruel and Unusual Films, which one has the most popularity? [/INST]
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Cruel and Unusual Films' ORDER BY T3.popularity DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: For the movie "Reign of Fire", which department was Marcia Ross in? [/INST]
SELECT T4.department_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id INNER JOIN department AS T4 ON T2.department_id = T4.department_id WHERE T3.person_name = 'Marcia Ross' AND T1.title = 'Reign of Fire';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Calculate the average budget of the movies directed by Jaume Collet-Serra. [/INST]
SELECT CAST(SUM(T1.budget) AS REAL) / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jaume Collet-Serra' AND T2.job = 'Director';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the percentage of male characters in the movie "Bride Wars"? [/INST]
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Bride Wars';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of the movie that was made with the most money and resources? [/INST]
SELECT title FROM movie ORDER BY budget DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many movies have made at least 1 Billion at the box office? [/INST]
SELECT COUNT(movie_id) FROM movie WHERE revenue > 1000000000;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: When was the first movie released? [/INST]
SELECT MIN(release_date) FROM movie WHERE movie_status = 'Released';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many crew are named John Young? [/INST]
SELECT COUNT(person_id) FROM person WHERE person_name = 'John Young';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the title of the movie that is most-liked by a large number of people. [/INST]
SELECT title FROM movie ORDER BY popularity DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Who is the person associated with the crew id 1325273? [/INST]
SELECT person_name FROM person WHERE person_id = 1325273;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the name of the production company that made the most movies? [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id ORDER BY COUNT(T2.movie_id) DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Who played Captain Jack Sparrow in all of the Pirates of the Caribbean movies? [/INST]
SELECT DISTINCT T3.person_name FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T2.character_name = 'Captain Jack Sparrow' AND T1.title LIKE 'Pirates of the Caribbean%';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is Walt Disney Pictures' most popular movie? [/INST]
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Walt Disney Pictures' ORDER BY T3.popularity DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many movies did Universal Studios release? [/INST]
SELECT COUNT(T2.movie_id) FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id WHERE T1.company_name = 'Universal Studios';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Which production company produced the movie that made the most money at the box office? [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id GROUP BY T1.company_id ORDER BY SUM(T3.revenue) DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many female crews are in the movie "Mr. Smith Goes to Washington"? [/INST]
SELECT COUNT(T3.gender) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Mr. Smith Goes to Washington' AND T3.gender = 'Female';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List the names of the production companies that made at least 200 movies. [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id GROUP BY T1.company_id HAVING COUNT(T2.movie_id) > 200;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many movies did Harrison Ford appear in total? [/INST]
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Harrison Ford';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of Jamie Foxx's most recent movie? [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jamie Foxx' ORDER BY T1.release_date DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many movies released in 1995 did Quentin Tarantino appear in? [/INST]
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Quentin Tarantino' AND CAST(STRFTIME('%Y', T1.release_date) AS INT) = 1995;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of the first crime movie ever released? [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Crime' ORDER BY T1.release_date LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many horror movies are there? [/INST]
SELECT COUNT(T1.movie_id) FROM movie_genres AS T1 INNER JOIN genre AS T2 ON T1.genre_id = T2.genre_id WHERE T2.genre_name = 'Horror';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List the person IDs of the second film editors in Movie No. 12. [/INST]
SELECT person_id FROM movie_crew WHERE movie_id = 12 AND job = 'Second Film Editor';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many animators does Movie No. 129 have? [/INST]
SELECT COUNT(movie_id) FROM movie_crew WHERE movie_id = 129 AND job = 'Animation';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: In Movie No. 19, how many people are there in Department No. 7? Please give me their job. [/INST]
SELECT COUNT(DISTINCT job) FROM movie_crew WHERE movie_id = 19 AND department_id = 7;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Write the person ID and character name of casts between order numbers 1 and 10 in Movie No. 285. [/INST]
SELECT person_id, character_name FROM movie_cast WHERE movie_id = 285 AND cast_order BETWEEN 1 AND 10;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many times did Bob Peterson appear in the movie credits? [/INST]
SELECT COUNT(T2.movie_id) FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Bob Peterson';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Tally the movie ID and character name in the movie starring Jim Carrey. [/INST]
SELECT T2.movie_id, T2.character_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T1.person_name = 'Jim Carrey';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Give the names of the female cast in Movie No. 1865. [/INST]
SELECT T2.person_name FROM movie_cast AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.person_id INNER JOIN gender AS T3 ON T1.gender_id = T3.gender_id WHERE T1.movie_id = 1865 AND T3.gender = 'Female';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Write me the titles of the movies starring Jim Carrey. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Jim Carrey';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List the director's name of the movies released between 1/01/1916 and 12/31/1925. [/INST]
SELECT T2.person_name FROM movie_cast AS T1 INNER JOIN person AS T2 ON T1.person_id = T2.person_id INNER JOIN movie AS T3 ON T1.movie_id = T3.movie_id INNER JOIN movie_crew AS T4 ON T1.movie_id = T4.movie_id WHERE T4.job = 'Director' AND T3.release_date BETWEEN '1916-01-01' AND '1925-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many films released between 1/2/1990 and 12/30/2000 starred Uma Thurman? [/INST]
SELECT COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T3.person_name = 'Uma Thurman' AND T1.release_date BETWEEN '1990-01-01' AND '2000-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Write the titles of horror films with a vote average of more than 7. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Horror' AND vote_average > 7;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Give the genre and popularity of movies whose revenue is at least 120,000,000 between 2012 and 2015. [/INST]
SELECT T3.genre_name, T1.popularity FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.revenue > 120000000 AND T1.release_date BETWEEN '2012-01-01' AND '2015-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: How many Indian movies between 1/2/1990 and 12/30/2003 have revenue of more than 75,000,000 and popularity of no less than 20? [/INST]
SELECT COUNT(T2.movie_id) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.revenue > 75000000 AND T1.popularity >= 20 AND T1.release_date BETWEEN '1990-01-01' AND '2003-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the title of the highest-budget film to date? Please include the revenue and name the country. [/INST]
SELECT T1.title, T1.revenue, T3.COUNTry_name FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id ORDER BY T1.budget DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List the title of movies in Latin released between 1/01/1990 and 12/31/1995. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_languages AS T2 ON T1.movie_id = T2.movie_id INNER JOIN language AS T3 ON T2.language_id = T3.language_id WHERE T3.language_name = 'Latin' AND T1.release_date BETWEEN '1990-01-01' AND '1995-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the average revenue of American movies in 2006? [/INST]
SELECT AVG(T1.revenue) FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'United States of America' AND CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2006;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Calculate the 2016 gap between the average revenue for Indian and American films. [/INST]
SELECT AVG(CASE WHEN T3.COUNTry_name = 'United States of America' THEN T1.revenue END) - AVG(CASE WHEN T3.COUNTry_name = 'India' THEN T1.revenue END) AS CALCULATE FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE CAST(STRFTIME('%Y', T1.release_date) AS INT) = 2016;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the percentage of romance films among films produced in India in 2015? [/INST]
SELECT CAST(COUNT(CASE WHEN T4.genre_name = 'Romance' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_COUNTry AS T3 ON T1.movie_id = T3.movie_id INNER JOIN genre AS T4 ON T2.genre_id = T4.genre_id INNER JOIN COUNTry AS T5 ON T3.COUNTry_id = T5.COUNTry_id WHERE T5.COUNTry_name = 'India' AND T1.release_date BETWEEN '2015-01-01' AND '2015-12-31';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Which actor plays Optimus Prime? [/INST]
SELECT DISTINCT T1.person_name FROM person AS T1 INNER JOIN movie_cast AS T2 ON T1.person_id = T2.person_id WHERE T2.character_name = 'Optimus Prime (voice)';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the gender of the character 'USAF Master Sgt. Epps?' [/INST]
SELECT T2.gender FROM movie_cast AS T1 INNER JOIN gender AS T2 ON T1.gender_id = T2.gender_id WHERE T1.character_name = 'USAF Master Sgt. Epps';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List all companies who worked in the movie 'Ultramarines: A Warhammer 40,000 Movie.' [/INST]
SELECT T1.company_name FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T3.title = 'Ultramarines: A Warhammer 40,000 Movie';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Which movie did the company 'Radiant Film GmbH' work on? [/INST]
SELECT T3.title FROM production_company AS T1 INNER JOIN movie_company AS T2 ON T1.company_id = T2.company_id INNER JOIN movie AS T3 ON T2.movie_id = T3.movie_id WHERE T1.company_name = 'Radiant Film GmbH';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What are the genres of Sky Captain and the World of Tomorrow? [/INST]
SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.title = 'Sky Captain and the World of Tomorrow';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Write all the keywords belonging to the movie 'Sky Captain and the World of Tomorrow.' [/INST]
SELECT T3.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T1.title = 'Sky Captain and the World of Tomorrow';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: The movie 'Gojira ni-sen mireniamu' is from which country? [/INST]
SELECT T3.COUNTry_name FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T1.title = 'Gojira ni-sen mireniamu';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Which movie has the keyword 'extremis?' [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'extremis';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List 10 movie titles that were produced in France. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'France' LIMIT 10;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Who is the director for the movie 'Transformers?' [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Transformers' AND T2.job = 'Director';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List 10 crews alongside their jobs who worked on the movie 'Mad Max: Fury Road.' [/INST]
SELECT T3.person_name FROM movie AS T1 INNER JOIN movie_crew AS T2 ON T1.movie_id = T2.movie_id INNER JOIN person AS T3 ON T2.person_id = T3.person_id WHERE T1.title = 'Mad Max: Fury Road' LIMIT 10;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What percentage of movies that came from Japan belong in the 'animation' genre? [/INST]
SELECT CAST(COUNT(CASE WHEN T4.genre_name = 'Animation' THEN T1.movie_id ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_id) FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN production_COUNTry AS T3 ON T1.movie_id = T3.movie_id INNER JOIN genre AS T4 ON T2.genre_id = T4.genre_id INNER JOIN COUNTry AS T5 ON T3.COUNTry_id = T5.COUNTry_id WHERE T5.COUNTry_name = 'Japan';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the ratio between male and female cast members of the movie 'Iron Man?' Count how many have unspecified genders. [/INST]
SELECT CAST(COUNT(CASE WHEN T3.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T3.gender = 'Female' THEN 1 ELSE NULL END) AS RATIO , COUNT(CASE WHEN T3.gender = 'Unspecified' THEN 1 ELSE NULL END) AS UNGENDERS FROM movie AS T1 INNER JOIN movie_cast AS T2 ON T1.movie_id = T2.movie_id INNER JOIN gender AS T3 ON T2.gender_id = T3.gender_id WHERE T1.title = 'Iron Man';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List down five movie titles that were released before 2000. [/INST]
SELECT title FROM movie WHERE CAST(STRFTIME('%Y', release_date) AS INT) < 2000 LIMIT 5;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the keyword ID of the movie with the title of "Sin City"? [/INST]
SELECT T2.keyword_id FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'Sin City';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Look for the movie title with the keyword of "angel". [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'angel';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Which keywords belong to the movie titles with the highest popularity? [/INST]
SELECT T3.keyword_name FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id ORDER BY T1.popularity DESC LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the genre ID of the movie with the title of "The Dark Knight". [/INST]
SELECT T2.genre_id FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title = 'The Dark Knight';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List down the movie titles within the genre of thriller. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T3.genre_name = 'Thriller';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Write down five rumoured movie titles within the genre of Drama. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.movie_status = 'Rumored' AND T3.genre_name = 'Drama' LIMIT 5;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the genre of the movie title with the lowest revenue generated? [/INST]
SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id ORDER BY T1.revenue LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: State the genre of the movie title with a runtime of only 14 minutes. [/INST]
SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id WHERE T1.runtime = 14;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the genre of the movie title which was well-received by the audiences but made the lowest revenue? [/INST]
SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T2.genre_id = T3.genre_id ORDER BY T1.vote_average DESC, T1.revenue LIMIT 1;
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Provide the genre of a movie title with a tagline of "A long time ago in a galaxy far, far away…". [/INST]
SELECT T3.genre_name FROM movie AS T1 INNER JOIN movie_genres AS T2 ON T1.movie_id = T2.movie_id INNER JOIN genre AS T3 ON T3.genre_id = T2.genre_id WHERE T1.tagline = 'A long time ago in a galaxy far, far away...';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: What is the country ID of the movie with the title of "Pirates of the Caribbean: Dead Man's Chest"? [/INST]
SELECT T2.COUNTry_id FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id WHERE T1.title LIKE 'Pirates of the Caribbean: Dead Man%s Chest';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: List down the movie titles that were produced in Canada. [/INST]
SELECT T1.title FROM movie AS T1 INNER JOIN production_COUNTry AS T2 ON T1.movie_id = T2.movie_id INNER JOIN COUNTry AS T3 ON T2.COUNTry_id = T3.COUNTry_id WHERE T3.COUNTry_name = 'Canada';
[INST] Here is a database schema: country : country_id [ INTEGER ] primary_key country_iso_code [ TEXT ] country_name [ TEXT ] department : department_id [ INTEGER ] primary_key department_name [ TEXT ] gender : gender_id [ INTEGER ] primary_key gender [ TEXT ] genre : genre_id [ INTEGER ] primary_key genre_name [ TEXT ] keyword : keyword_id [ INTEGER ] primary_key keyword_name [ TEXT ] language : language_id [ INTEGER ] primary_key language_code [ TEXT ] language_name [ TEXT ] language_role : role_id [ INTEGER ] primary_key language_role [ TEXT ] movie : movie_id [ INTEGER ] primary_key title [ TEXT ] budget [ INTEGER ] homepage [ TEXT ] overview [ TEXT ] popularity [ REAL ] release_date [ DATE ] revenue [ INTEGER ] runtime [ INTEGER ] movie_status [ TEXT ] tagline [ TEXT ] vote_average [ REAL ] vote_count [ INTEGER ] movie_genres : movie_id [ INTEGER ] movie_genres.movie_id = movie.movie_id genre_id [ INTEGER ] movie_genres.genre_id = genre.genre_id movie_languages : movie_id [ INTEGER ] movie_languages.movie_id = movie.movie_id language_id [ INTEGER ] movie_languages.language_id = language.language_id language_role_id [ INTEGER ] movie_languages.language_role_id = language_role.role_id person : person_id [ INTEGER ] primary_key person_name [ TEXT ] movie_crew : movie_id [ INTEGER ] movie_crew.movie_id = movie.movie_id person_id [ INTEGER ] movie_crew.person_id = person.person_id department_id [ INTEGER ] movie_crew.department_id = department.department_id job [ TEXT ] production_company : company_id [ INTEGER ] primary_key company_name [ TEXT ] production_country : movie_id [ INTEGER ] production_country.movie_id = movie.movie_id country_id [ INTEGER ] production_country.country_id = country.country_id movie_cast : movie_id [ INTEGER ] movie_cast.movie_id = movie.movie_id person_id [ INTEGER ] movie_cast.person_id = person.person_id character_name [ TEXT ] gender_id [ INTEGER ] movie_cast.gender_id = gender.gender_id cast_order [ INTEGER ] movie_keywords : movie_id [ INTEGER ] keyword_id [ INTEGER ] movie_company : movie_id [ INTEGER ] company_id [ INTEGER ] Please write me a SQL statement that answers the following question: Accumulate the budget of the movie titles with the keyword of "video game". [/INST]
SELECT SUM(T1.budget) FROM movie AS T1 INNER JOIN movie_keywords AS T2 ON T1.movie_id = T2.movie_id INNER JOIN keyword AS T3 ON T2.keyword_id = T3.keyword_id WHERE T3.keyword_name = 'video game';