Chinastark/bird_dataset huggingface dataset:
Database: retail_complains
Note: female refers to sex = 'Female';
Question: Among the female clients that age between 20 to 40, list the date when their complaints were received.
SQL: SELECT DISTINCT callcenterlogs.`date received` FROM client INNER JOIN EVENTS ON client.client_id = EVENTS.client_id INNER JOIN callcenterlogs ON EVENTS.`complaint id` = callcenterlogs.`complaint id` WHERE client.age BETWEEN 20 AND 40 AND client.sex = 'Female'
Database: retail_complains
Note: 1 star refers to stars = 1; on March 14, 2016 refers to date = '2016-03-14'; Newton refers to city = 'Newton'; Massachusetts refers to state_abbrev = 'MA';
Question: List the product reviewed with 1 star on March 14, 2016 from Newton, Massachusetts.
SQL: SELECT reviews.product FROM district INNER JOIN reviews ON district.district_id = reviews.district_id WHERE district.city = 'Newton' AND district.state_abbrev = 'MA' AND reviews.date = '2016-03-14' AND reviews.stars = 1
Database: retail_complains
Note: 5 star refers to stars = 5; Nashville refers to city = 'Nashville'; Tennessee refers to state_abbrev = 'TN';
Question: In reviews for the Eagle National Bank product, how many of the 5 star reviews where from Nashville, Tennessee?
SQL: SELECT count(reviews.stars) FROM district INNER JOIN reviews ON district.district_id = reviews.district_id WHERE district.city = 'Nashville' AND district.state_abbrev = 'TN' AND reviews.product = 'Eagle National Mortgage' AND reviews.stars = 5
Database: retail_complains
Note: male refers to sex = 'Male'; age 25 and below refers to age < 25;
Question: What are the issues of the complains of male clients and products from age 25 and below?
SQL: SELECT DISTINCT EVENTS.issue FROM client INNER JOIN EVENTS ON client.client_id = EVENTS.client_id WHERE client.sex = 'Male' AND client.age < 25
Database: retail_complains
Note: 1 star refers to stars = 1;
Question: Among the reviews from midwest region, what are the products that received 1 star?
SQL: SELECT DISTINCT reviews.product FROM state INNER JOIN district ON state.statecode = district.state_abbrev INNER JOIN reviews ON district.district_id = reviews.district_id WHERE state.region = 'Midwest' AND reviews.stars = 1
Database: retail_complains
Note: on March 2017 refers to date received LIKE '%03%' AND date received LIKE '2017%';
Question: List the products involved in the complaints received on March 2017 via TOVA server.
SQL: SELECT DISTINCT EVENTS.product FROM callcenterlogs INNER JOIN EVENTS ON callcenterlogs.`complaint id` = EVENTS.`complaint id` WHERE callcenterlogs.server = 'TOVA' AND EVENTS.`date received` LIKE '2017-03%'
Database: retail_complains
Note: 5 stars refers to stars = 5; on December 17 2017 refers to date = '2017-12-17';
Question: What is the division of the review of 5 stars received on December 17, 2017 for the product Eagle National Mortgage?
SQL: SELECT district.division FROM district INNER JOIN reviews ON district.district_id = reviews.district_id WHERE reviews.stars = 5 AND reviews.date = '2017-12-17' AND reviews.product = 'Eagle National Mortgage'
Database: retail_complains
Note: oldest refers to max(age);
Question: In complaints about the credit card product, list the phone number of the oldest client.
SQL: SELECT client.phone FROM client INNER JOIN EVENTS ON client.client_id = EVENTS.client_id WHERE EVENTS.product = 'Credit card' ORDER BY client.age DESC LIMIT 1
Database: retail_complains
Note: in 2014 refers to date received LIKE '2014%'; submitted via call refers to submitted via = 'phone';
Question: In complaints received in 2014, how many of them were submitted via call?
SQL: SELECT count(EVENTS.`complaint id`) FROM callcenterlogs INNER JOIN EVENTS ON callcenterlogs.`complaint id` = EVENTS.`complaint id` WHERE EVENTS.`submitted via` = 'Phone' AND strftime('%Y', callcenterlogs.`date received`) = '2014'
Database: retail_complains
Note: age greater than the 60% of average age refers to age > multiply(avg(age) , 0.6);
Question: List the product and its issues of the complains of clients with age greater than the 60% of average age of all clients.
SQL: SELECT DISTINCT EVENTS.product, EVENTS.issue FROM client INNER JOIN EVENTS ON client.client_id = EVENTS.client_id WHERE client.age * 100 > ( SELECT avg(age) * 60 FROM client )
Database: retail_complains
Note: 5 stars refers to stars = 5; percentage = divide(count(division = 'East North Central', count(division)) * 100%;
Question: In reviews of product with 5 stars, what is the percentage of the reviews coming from the division of East North Central?
SQL: SELECT cast(sum(CASE WHEN district.division = 'East North Central' THEN 1 ELSE 0 END) AS REAL) * 100 / count(district.division) FROM district INNER JOIN reviews ON district.district_id = reviews.district_id WHERE reviews.stars = 5
Database: movies_4
Note: names of the production company refers to movie_company; movie "Four Rooms" refers to title = 'Four Rooms';
Question: Please list the names of the production company of the movie "Four Rooms".
SQL: SELECT production_company.company_name FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE movie.title = 'Four Rooms'
Database: movies_4
Note: movie "Four Rooms" refers to title = 'Four Rooms';
Question: How many production companies does the movie "Four Rooms" have?
SQL: SELECT count(cname) FROM ( SELECT production_company.company_name AS cname FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE movie.title = 'Four Rooms' )
Database: movies_4
Note: "Universal Pictures" refers to company_name = 'Universal Pictures';
Question: Please list the titles of all the movie produced by production company "Universal Pictures".
SQL: SELECT movie.title FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE production_company.company_name = 'Universal Pictures'
Database: movies_4
Note: "Universal Pictures" refers to company_name = 'Universal Pictures'; latest released refers to max(release_date);
Question: What is the title of the latest released movie produced by production company "Universal Pictures"?
SQL: SELECT movie.title FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE production_company.company_name = 'Universal Pictures' ORDER BY movie.release_date DESC LIMIT 1
Database: movies_4
Note: name of the director of photography refers to person_name where job = 'Director of Photography'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End';
Question: What is the name of the director of photography of the movie "Pirates of the Caribbean: At World's End"?
SQL: SELECT person.person_name FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title LIKE 'Pirates of the Caribbean: At World%s End' AND movie_crew.job = 'Director of Photography'
Database: movies_4
Note: movie "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End';
Question: What was the job of Dariusz Wolski in the movie "Pirates of the Caribbean: At World's End"?
SQL: SELECT movie_crew.job FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title LIKE 'Pirates of the Caribbean: At World%s End' AND person.person_name = 'Dariusz Wolski'
Database: movies_4
Note: names refers to person_name; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End';
Question: Please list the names of all the crew members of the movie "Pirates of the Caribbean: At World's End".
SQL: SELECT person.person_name FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title LIKE 'Pirates of the Caribbean: At World%s End'
Database: movies_4
Note: worked as producer refers to job = 'Producer'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End';
Question: How many crew members worked as producer in the movie "Pirates of the Caribbean: At World's End"?
SQL: SELECT count(person.person_id) FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title LIKE 'Pirates of the Caribbean: At World%s End' AND movie_crew.job = 'Producer'
Database: movies_4
Note: names refers to person_name; producers refers to job = 'Producer'; "Pirates of the Caribbean: At World's End" refers to title = 'Pirates of the Caribbean: At World''s End';
Question: Please list the names of all the producers in the movie "Pirates of the Caribbean: At World's End".
SQL: SELECT person.person_name FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title LIKE 'Pirates of the Caribbean: At World%s End' AND movie_crew.job = 'Producer'
Database: movies_4
Note: director of photography refers to job = 'Director of Photography';
Question: In how many movie does Dariusz Wolski work as the director of photography?
SQL: SELECT count(movie_crew.movie_id) FROM person INNER JOIN movie_crew ON person.person_id = movie_crew.person_id WHERE person.person_name = 'Dariusz Wolski' AND movie_crew.job = 'Director of Photography'
Database: movies_4
Note: director of photography refers to job = 'Director of Photography'; highest average vote refers to max(vote_average);
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?
SQL: SELECT movie.title FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'Dariusz Wolski' AND movie_crew.job = 'Director of Photography' ORDER BY movie.vote_average DESC LIMIT 1
Database: movies_4
Note: release date of the latest movie refers to max(release_date);
Question: When was the release date of the latest movie in which Dariusz Wolski worked as a crew member?
SQL: SELECT movie.release_date FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'Dariusz Wolski' ORDER BY movie.release_date DESC LIMIT 1
Database: movies_4
Note: director of photography refers to job = 'Director of Photography'; vote average is over 8.0 refers to vote_average > 5; percentage = divide(sum(movie_id) when vote_average > 5, count(movie_id)) as percentage;
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?
SQL: SELECT cast(count(CASE WHEN movie.vote_average > 5 THEN 1 ELSE NULL END) AS REAL) * 100 / count(movie.vote_average) FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'Dariusz Wolski' AND movie_crew.job = 'Director of Photography'
Database: movies_4
Note: director of photography refers to job = 'Director of Photography'; average revenue = divide(sum(revenue), count(movie_id));
Question: What is the average revenue of the movie in which Dariusz Wolski works as the director of photography?
SQL: SELECT cast(sum(movie.revenue) AS REAL) / count(movie.movie_id) FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'Dariusz Wolski' AND movie_crew.job = 'Director of Photography'
Database: movies_4
Note: name of the movie refers to title; revenue of 559852396 refers to revenue = '559852396';
Question: Give the name of the movie with a revenue of 559852396.
SQL: SELECT title FROM movie WHERE revenue = 559852396
Database: movies_4
Note: "Days of Thunder" refers to title = 'Days of Thunder';
Question: What was David Rubin's job in the movie "Days of Thunder"?
SQL: SELECT movie_crew.job FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'David Rubin' AND movie.title = 'Days of Thunder'
Database: movies_4
Note: directed by refers to job = 'Director';
Question: How many movies were directed by Michael Bay?
SQL: SELECT count(movie_crew.movie_id) FROM person INNER JOIN movie_crew ON person.person_id = movie_crew.person_id WHERE person.person_name = 'Michael Bay' AND movie_crew.job = 'Director'
Database: movies_4
Note: "I Hope They Serve Beer in Hell" refers to title = 'I Hope They Serve Beer in Hell';
Question: Show the total number of keywords of the movie "I Hope They Serve Beer in Hell".
SQL: SELECT count(movie_keywords.keyword_id) FROM movie INNER JOIN movie_keywords ON movie.movie_id = movie_keywords.movie_id WHERE movie.title = 'I Hope They Serve Beer in Hell'
Database: movies_4
Note: "Land of the Dead" refers to title = 'Land of the Dead'; director refers to person_name where job = 'Director';
Question: For the movie "Land of the Dead", who is its director?
SQL: SELECT person.person_name FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE movie.title = 'Land of the Dead' AND movie_crew.job = 'Director'
Database: movies_4
Note: Paramount Animation refers to company_name = 'Paramount Animation';
Question: Tell the number of movies made by Paramount Animation.
SQL: SELECT count(movie_company.movie_id) FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id WHERE production_company.company_name = 'Paramount Animation'
Database: movies_4
Note: female characters refer to gender = 'Female'; "Spider-Man 3" refers to title = 'Spider-Man 3';
Question: How many female characters are there in the movie "Spider-Man 3"?
SQL: SELECT count(*) FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN gender ON movie_cast.gender_id = gender.gender_id WHERE movie.title = 'Spider-Man 3' AND gender.gender = 'Female'
Database: movies_4
Note: most used keyword refers to keyword_name where max(count(keyword_name));
Question: Provide the most used keyword in the movies.
SQL: SELECT keyword.keyword_name FROM keyword INNER JOIN movie_keywords ON keyword.keyword_id = movie_keywords.keyword_id GROUP BY keyword.keyword_name ORDER BY count(keyword.keyword_name) DESC LIMIT 1
Database: movies_4
Note: producers refers to job = 'Producer'; "The Amityville Horror" refers to title = 'The Amityville Horror';
Question: How many producers does the movie "The Amityville Horror" have?
SQL: SELECT count(movie_crew.person_id) FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id WHERE movie.title = 'The Amityville Horror' AND movie_crew.job = 'Producer'
Database: movies_4
Note: movie "Crazy Heart" refers to title = 'Crazy Heart'; production company refers to company_name;
Question: What is the production company of the movie "Crazy Heart"?
SQL: SELECT production_company.company_name FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE movie.title = 'Crazy Heart'
Database: movies_4
Note: "saving the world" as the keyword refers to keyword_name = 'saving the world';
Question: Give the number of movies with "saving the world" as the keyword.
SQL: SELECT count(movie_keywords.movie_id) FROM keyword INNER JOIN movie_keywords ON keyword.keyword_id = movie_keywords.keyword_id WHERE keyword_name = 'saving the world'
Database: movies_4
Note: produced by Cruel and Unusual Films refers to company_name = 'Cruel and Unusual Films'; most popularity refers to max(popularity);
Question: For all the movies which were produced by Cruel and Unusual Films, which one has the most popularity?
SQL: SELECT movie.title FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE production_company.company_name = 'Cruel and Unusual Films' ORDER BY movie.popularity DESC LIMIT 1
Database: movies_4
Note: movie "Reign of Fire" refers to title = 'Reign of Fire'; which department refers to department_name;
Question: For the movie "Reign of Fire", which department was Marcia Ross in?
SQL: SELECT department.department_name FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id INNER JOIN department ON movie_crew.department_id = department.department_id WHERE person.person_name = 'Marcia Ross' AND movie.title = 'Reign of Fire'
Database: movies_4
Note: directed by refers to job = 'Director'; average budget = AVG(budget);
Question: Calculate the average budget of the movies directed by Jaume Collet-Serra.
SQL: SELECT cast(sum(movie.budget) AS REAL) / count(movie.movie_id) FROM movie INNER JOIN movie_crew ON movie.movie_id = movie_crew.movie_id INNER JOIN person ON movie_crew.person_id = person.person_id WHERE person.person_name = 'Jaume Collet-Serra' AND movie_crew.job = 'Director'
Database: movies_4
Note: male refers to gender = 'Male'; "Bride Wars" refers to title = 'Bride Wars'; percentage = divide(sum(gender = 'Male'), count(gender)) * 100 as percentage;
Question: What is the percentage of male characters in the movie "Bride Wars"?
SQL: SELECT cast(count(CASE WHEN gender.gender = 'Male' THEN 1 ELSE NULL END) AS REAL) * 100 / count(gender.gender) FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN gender ON movie_cast.gender_id = gender.gender_id WHERE movie.title = 'Bride Wars'
Database: movies_4
Note: made with the most money and resources refers to max(budget);
Question: What is the title of the movie that was made with the most money and resources?
SQL: SELECT title FROM movie ORDER BY budget DESC LIMIT 1
Database: movies_4
Note: have made at least 1 Billion at the box office refers to revenue > 1000000000;
Question: How many movies have made at least 1 Billion at the box office?
SQL: SELECT count(movie_id) FROM movie WHERE revenue > 1000000000
Database: movies_4
Note: when the first movie refers to release_date where min(release_date);
Question: When was the first movie released?
SQL: SELECT min(release_date) FROM movie WHERE movie_status = 'Released'
Database: movies_4
Question: How many crew are named John Young?
SQL: SELECT count(person_id) FROM person WHERE person_name = 'John Young'
Database: movies_4
Note: most-liked by a large number of people refers to max(popularity);
Question: Provide the title of the movie that is most-liked by a large number of people.
SQL: SELECT title FROM movie ORDER BY popularity DESC LIMIT 1
Database: movies_4
Note: Who is the person refers to person_name; crew id 1325273 refers to person_id = 1325273;
Question: Who is the person associated with the crew id 1325273?
SQL: SELECT person_name FROM person WHERE person_id = 1325273
Database: movies_4
Note: name of the production company refers to company_name; most movies refers to max(count(company_name));
Question: What is the name of the production company that made the most movies?
SQL: SELECT production_company.company_name FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id GROUP BY production_company.company_id ORDER BY count(movie_company.movie_id) DESC LIMIT 1
Database: movies_4
Note: Captain Jack Sparrow refers to character_name = 'Captain Jack Sparrow'; Pirates of the Caribbean movies refers to title LIKE 'Pirates of the Carribbean%';
Question: Who played Captain Jack Sparrow in all of the Pirates of the Caribbean movies?
SQL: SELECT DISTINCT person.person_name FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN person ON movie_cast.person_id = person.person_id WHERE movie_cast.character_name = 'Captain Jack Sparrow' AND movie.title LIKE 'Pirates of the Caribbean%'
Database: movies_4
Note: Walt Disney Pictures refers to company_name = 'Walt Disney Pictures'; most popular movie refers to max(popularity);
Question: What is Walt Disney Pictures' most popular movie?
SQL: SELECT movie.title FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id WHERE production_company.company_name = 'Walt Disney Pictures' ORDER BY movie.popularity DESC LIMIT 1
Database: movies_4
Note: Universal Studios refers to company_name = 'Universal Studios';
Question: How many movies did Universal Studios release?
SQL: SELECT count(movie_company.movie_id) FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id WHERE production_company.company_name = 'Universal Studios'
Database: movies_4
Note: Which production company refers to company_name; most money at the box office refers to max(revenue);
Question: Which production company produced the movie that made the most money at the box office?
SQL: SELECT production_company.company_name FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id INNER JOIN movie ON movie_company.movie_id = movie.movie_id GROUP BY production_company.company_id ORDER BY sum(movie.revenue) DESC LIMIT 1
Database: movies_4
Note: female crews refers to gender = 'Female'; "Mr. Smith Goes to Washington" refers to title = 'Mr. Smith Goes to Washington';
Question: How many female crews are in the movie "Mr. Smith Goes to Washington"?
SQL: SELECT count(gender.gender) FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN gender ON movie_cast.gender_id = gender.gender_id WHERE movie.title = 'Mr. Smith Goes to Washington' AND gender.gender = 'Female'
Database: movies_4
Note: names of the production companies refers to company_name; at least 200 movies refers to COUNT(company_name) >= 200;
Question: List the names of the production companies that made at least 200 movies.
SQL: SELECT production_company.company_name FROM production_company INNER JOIN movie_company ON production_company.company_id = movie_company.company_id GROUP BY production_company.company_id HAVING count(movie_company.movie_id) > 200
Database: movies_4
Question: How many movies did Harrison Ford appear in total?
SQL: SELECT count(movie_cast.movie_id) FROM person INNER JOIN movie_cast ON person.person_id = movie_cast.person_id WHERE person.person_name = 'Harrison Ford'
Database: movies_4
Note: most recent movie refers to max(release_date);
Question: What is the title of Jamie Foxx's most recent movie?
SQL: SELECT movie.title FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN person ON movie_cast.person_id = person.person_id WHERE person.person_name = 'Jamie Foxx' ORDER BY movie.release_date DESC LIMIT 1
Database: movies_4
Note: released in 1995 refers to release_date LIKE '1995%';
Question: How many movies released in 1995 did Quentin Tarantino appear in?
SQL: SELECT count(movie.movie_id) FROM movie INNER JOIN movie_cast ON movie.movie_id = movie_cast.movie_id INNER JOIN person ON movie_cast.person_id = person.person_id WHERE person.person_name = 'Quentin Tarantino' AND cast(strftime('%Y', movie.release_date) AS INT) = 1995
Database: movies_4
Note: first crime movie ever released refers to min(release_date) and genre_name = 'Crime';
Question: What is the title of the first crime movie ever released?
SQL: SELECT movie.title FROM movie INNER JOIN movie_genres ON movie.movie_id = movie_genres.movie_id INNER JOIN genre ON movie_genres.genre_id = genre.genre_id WHERE genre.genre_name = 'Crime' ORDER BY movie.release_date LIMIT 1