Chinastark/bird_dataset huggingface dataset:
Database: simpson_episodes
Note: aired in the year 2009 refers to air_date like '2009%'; 10 stars in star score refers to stars = 10; over 15% of voters refers to votes.percent > 15;
Question: How many episodes aired in the year 2009 have over 15% of voters giving 10 stars in star score?
SQL: SELECT count(*) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE substr(episode.air_date, 1, 4) = '2009' AND vote.stars = 10 AND vote.percent > 15;
Database: simpson_episodes
Note: 7-stars vote refers to stars = 7;  most refers to Max(votes);
Question: What's the title of the episode that got the most 7-star votes in star score?
SQL: SELECT episode.title FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE vote.stars = 7 ORDER BY vote.votes DESC LIMIT 1;
Database: simpson_episodes
Note: "Lost Verizon" is the title of episode; stars on average = Divide( Sum (Multiply (votes, stars)), Sum(votes));
Question: How many stars on average does the episode Lost Verizon have?
SQL: SELECT cast(sum(vote.votes * vote.stars) AS REAL) / sum(vote.votes) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'Lost Verizon';
Database: simpson_episodes
Note: "Primetime Emmy' is the award_category;  rating over 7 refers to rating > 7; nominated refers to result = 'Nominee'; percentage = Divide(Count(episode_id(award_category = 'Primetime Emmy')), Count (episode_id)) * 100;
Question: What is the percentage of Primetime Emmy nominated episodes with a rating over 7 to all the episodes that have a rating over 7?
SQL: SELECT cast(sum(CASE WHEN award.award_category = 'Primetime Emmy' THEN 1 ELSE 0 END) AS REAL) * 100 / count(*) FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE episode.rating > 7 AND award.result = 'Nominee';
Database: simpson_episodes
Note: "Pamela Hayden" is the person; voice the character 'Ruthie' refers to role = 'Ruthie';
Question: Name the title of the episode where Pamela Hayden voiced the character 'Ruthie.'
SQL: SELECT episode.title FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE credit.person = 'Pamela Hayden' AND credit.role = 'Ruthie';
Database: simpson_episodes
Note: "Matt Groening" is the person; 'In the name of the Grandfather' is the title of episode; episode number refers to episode; series number refers to number_in_series;
Question: List down all the roles of Matt Groening on the episode titled 'In the Name of the Grandfather' along with the episode number and series number.
SQL: SELECT credit.role, episode.episode, episode.number_in_series FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE credit.person = 'Matt Groening' AND episode.title = 'In the Name of the Grandfather';
Database: simpson_episodes
Question: Write down the title and summary of the episode with the keyword 'eviction.'
SQL: SELECT episode.title, episode.summary FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE keyword.keyword = 'eviction';
Database: simpson_episodes
Note: "Wedding for Disaster" is the title of episode; average number of stars = Divide(Sum(stars), Count(stars));
Question: What is the average number of stars received by the episode titled 'Wedding for Disaster.'
SQL: SELECT avg(vote.stars) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'Wedding for Disaster';
Database: simpson_episodes
Note: aired on 3/22/2009 refers to air_date = '2009-03-22';
Question: Write the title and all the keywords of the episode that was aired on 3/22/2009.
SQL: SELECT episode.title, keyword.keyword FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.air_date = '2009-03-22';
Database: simpson_episodes
Note: voiced refers to role; role = 'Helen Lovejoy";
Question: What is the birth name of the person who voiced 'Helen Lovejoy?'
SQL: SELECT DISTINCT person.birth_name FROM person INNER JOIN credit ON person.name = credit.person WHERE credit.role = 'Helen Lovejoy';
Database: simpson_episodes
Note: uncredited refers to credited = ''; credited refers to credited = 'true'; won refers to result = 'Winner'; 2017 is the year; 'Jupiter award' is the award_category; 'Best International TV Series' is the award; percentage ratio = Divide (SUM(credited = ''), SUM(credited = 'true')) * 100;
Question: What is the percentage ratio between uncredited and credited roles on the episode that won the 2017 Jupiter Award for Best International TV Series? Please include the title of the episode and the names of the persons who were uncredited alongside their role in that episode.
SQL: SELECT cast(sum(CASE WHEN credit.credited = 'false' THEN 1 END) AS REAL) * 100 / sum(CASE WHEN credit.credited = 'true' THEN 1 END), episode.title, credit.person FROM award INNER JOIN credit ON credit.episode_id = award.episode_id INNER JOIN episode ON award.episode_id = episode.episode_id WHERE substr(award.year, 1, 4) = '2017' AND award.award_category = 'Jupiter Award' AND award.award = 'Best International TV Series' AND award.result = 'Winner';
Database: simpson_episodes
Note: more than 1000 votes refers to votes > 1000;
Question: How many episodes have more than 1000 votes?
SQL: SELECT count(episode_id) FROM episode WHERE votes > 1000;
Database: simpson_episodes
Note: "New York" is the birth_place; 'USA' is the birth_region;
Question: How many persons were born in New York, USA?
SQL: SELECT count(name) FROM person WHERE birth_place = 'New York City' AND birth_country = 'USA';
Database: simpson_episodes
Note: "Marc Wilmore" is the name of person;
Question: List the name of all awards along with the award category, nominated by Marc Wilmore.
SQL: SELECT award_id, award_category FROM award WHERE person = 'Marc Wilmore';
Database: simpson_episodes
Note: crew refers to person; full name refers to name; have nickname refers to nickname IS NOT NULL;
Question: How many crew have their own nickname? List their full name along with the nickname.
SQL: SELECT count(name) FROM person WHERE nickname IS NOT NULL;
Database: simpson_episodes
Note: average high = Divide(Sum(height_meters), Count(name));
Question: Find the average height for each person.
SQL: SELECT avg(height_meters) FROM person;
Database: simpson_episodes
Note: highest vote refers to Max(votes); lowest vote refers to Min(votes); difference = Subtract(Max(votes), Min(votes));
Question: Calculate the difference between the highest votes for episode and the lowest votes for episode.
SQL: SELECT max(votes) - min(votes) FROM vote;
Database: simpson_episodes
Note: in 2009 refers to year = 2009;
Question: List the name character awarded for the Outstanding Voice-Over Performance award in 2009.
SQL: SELECT character_award.character FROM award INNER JOIN character_award ON award.award_id = character_award.award_id WHERE award.year = 2009 AND award.award = 'Outstanding Voice-Over Performance';
Database: simpson_episodes
Note: nominated refers to result = 'Nominee'; born in California refers to birth_place = 'California'; in 2009 refers to year = 2009;
Question: Among the person nominated for the Comedy Series Award in 2009, how many of them were born in California?
SQL: SELECT count(*) FROM person INNER JOIN award ON person.name = award.person WHERE award.year = 2009 AND award.award = 'Comedy Series' AND person.birth_region = 'California';
Database: simpson_episodes
Note: won refers to result = 'Winner'; in 2017 refers to year = 2017;
Question: What is the title of episode that won the Best International TV Series Award in 2017?
SQL: SELECT episode.title FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE substr(award.year, 1, 4) = '2017' AND award.award = 'Best International TV Series' AND award.result = 'Winner';
Database: simpson_episodes
Note: "How the Test Was Won" is the title of episode; not included in the credit refers to credited = ' '; name of person refers to person;
Question: List the name of persons who were not included in the credit for the 'How the Test Was Won' episode.
SQL: SELECT credit.person FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.title = 'How the Test Was Won' AND credit.credited = 'false';
Database: simpson_episodes
Note: "riot" and "cake" are both keyword;
Question: What is the title of episode that has a keyword of 'riot' and 'cake'?
SQL: SELECT DISTINCT episode.title FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE keyword.keyword IN ('riot', 'cake');
Database: simpson_episodes
Note: 10 stars rating refers to stars = 10; most vote refers to Max(votes);
Question: Which episode has the most vote for 10 stars rating?
SQL: SELECT episode.title FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE vote.stars = 10 ORDER BY episode.votes DESC LIMIT 1;
Database: simpson_episodes
Note: aired between October to November refers to strftime('%m', air_date) between '10' and '11';
Question: Name all the person who involved in the making of simpson 20s episode that aired between October to November.
SQL: SELECT DISTINCT credit.person FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE substr(episode.air_date, 6, 2) BETWEEN '10' AND '11';
Database: simpson_episodes
Note: "Treehouse of Horror XIX" is the title of episode; 'director' is the role of person; name refers to person;
Question: State the name of director for the 'Treehouse of Horror XIX' episode.
SQL: SELECT credit.person FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.title = 'Treehouse of Horror XIX' AND credit.role = 'director';
Database: simpson_episodes
Note: 5th episode refers to episode = 5;
Question: Based on the credits, state how many roles were played in the 5th episode of simpson 20.
SQL: SELECT count(DISTINCT credit.role) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.episode = 5;
Database: simpson_episodes
Note: "Take My Life,Please" is the title of episode;
Question: List all the keyword for 'Take My Life, Please' episode.
SQL: SELECT keyword.keyword FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.title = 'Take My Life, Please';
Database: simpson_episodes
Note: more than 950 votes refers to votes > 950; in 2009 refers to year = 2009; number of episode = Count(episode_id); nominated refers to result = 'Nominee'; percentage = Divide(Count(award = 'Outstanding Voice-Over Performance'), Count(episode_id)) * 100;
Question: Among the episode that get more than 950 votes, how many of the episodes were nominated for the 'Outstanding Voice-Over Performance Award in 2009'? Find the percentage of the episodes.
SQL: SELECT cast(sum(CASE WHEN award.award = 'Outstanding Voice-Over Performance' THEN 1 ELSE 0 END) AS REAL) * 100 / count(episode.episode_id) FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE episode.votes > 950 AND award.year = 2009;
Database: simpson_episodes
Note: 5 stars votes refers to stars = 5 ; 'No Loan Again, Naturally' and 'Coming to Homerica' are both the title of episode;  ratio = Divide (votes where title = 'No Loan Again, Naturally', votes where title = 'Coming to Homerica');
Question: What is the ratio between the 5 stars votes for 'No Loan Again, Naturally' episode and 'Coming to Homerica' episode?
SQL: SELECT cast(sum(CASE WHEN episode.title = 'No Loan Again, Naturally' THEN episode.votes ELSE 0 END) AS REAL) / sum(CASE WHEN episode.title = 'Coming to Homerica' THEN episode.votes ELSE 0 END) AS ratio FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE vote.stars = 5;
Database: simpson_episodes
Note: "Ian Maxtone-Graham" is the person; nominated refers to result = 'Nominee'; 'Writers Guild of America, USA' is the organization;
Question: How many times was Ian Maxtone-Graham nominated for an award in Writers Guild of America, USA?
SQL: SELECT count(award_id) FROM award WHERE person = 'Ian Maxtone-Graham' AND organization = 'Writers Guild of America, USA' AND RESULT = 'Nominee';
Database: simpson_episodes
Note: nominated refers to result = 'Nominee'; highest number of nominated award refers to Max(Count(person));
Question: What is the name of the person that has the highest number of nominated award but didn't win?
SQL: SELECT person FROM award WHERE RESULT = 'Nominee' GROUP BY person ORDER BY count(person) DESC LIMIT 1;
Database: simpson_episodes
Note: lowest rating refers to Min(rating);
Question: What is the title of the episode that received the lowest rating?
SQL: SELECT title FROM episode ORDER BY rating LIMIT 1;
Database: simpson_episodes
Note: "Favorite Animated Comedy" is the award; 'People's Choice award' is the award_category; received award refers to result = 'Winner'; first ever award refers to Min(year);
Question: What year did the Simpsons receive its first ever award for Favorite Animated Comedy in People's Choice Award?
SQL: SELECT YEAR FROM award WHERE RESULT = 'Winner' AND award = 'Favorite Animated Comedy' ORDER BY YEAR DESC LIMIT 1;
Database: simpson_episodes
Note: "Dell Hake" is the person; not included in the credit list refers to credited = '';
Question: How many episodes was Dell Hake not included in the credit list?
SQL: SELECT count(*) FROM credit WHERE person = 'Dell Hake' AND credited = 'false';
Database: simpson_episodes
Note: "Outstanding Voice-Over Performance" is the award; 'Primetime Emmy awards' is the organization; awardee refers to result = 'Winner'; first ever award refers to Min(year); age at the time of awarded refers to Subtract(year, SUBSTR(birthdate, 0, 5));
Question: How old was the awardee when he/she won the first-ever award for Outstanding Voice-Over Performance in Primetime Emmy Awards?
SQL: SELECT award.year - cast(substr(person.birthdate, 1, 4) AS int) AS age FROM person INNER JOIN award ON person.name = award.person WHERE award.award = 'Outstanding Voice-Over Performance' AND award.organization = 'Primetime Emmy Awards' AND award.result = 'Winner';
Database: simpson_episodes
Note: "Dan Castellaneta" is the person; won refers to result = 'Winner'; 'Outstanding Voice-Over Performance' is the award; 'Primetime Emmy awards' is the organization; in 2009 refers to year = 2009;
Question: What character did Dan Castellaneta play that won him an award for Outstanding Voice-Over Performance in 2009 in the Primetime Emmy Awards?
SQL: SELECT DISTINCT character_award.character FROM award INNER JOIN character_award ON award.award_id = character_award.award_id WHERE award.person = 'Dan Castellaneta' AND award.award = 'Outstanding Voice-Over Performance' AND award.organization = 'Primetime Emmy Awards' AND award.year = 2009;
Database: simpson_episodes
Note: aired on refers to air_date, April refers to SUBSTR(air_date, 6, 2) = '04'; 2009 refers to SUBSTR (air_date, 0, 5) = '2009';
Question: Among the episodes aired on April of 2009, how many episodes won an award?
SQL: SELECT count(award.episode_id) FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE substr(award.year, 1, 4) = '2009' AND episode.air_date LIKE '2009-04%';
Database: simpson_episodes
Note: won refers to result = 'Winner'; 'Best Voice-Over Performance' is the award; ' Online Film & Television Association' is the organization; in 2009 refers to year = 2009;
Question: What is the birth place of the cast or crew member who won the Best Voice-Over Performance in Online Film & Television Association in 2009?
SQL: SELECT person.birth_place FROM person INNER JOIN award ON person.name = award.person WHERE award.award = 'Best Voice-Over Performance' AND award.organization = 'Online Film & Television Association' AND award.year = 2009;
Database: simpson_episodes
Note: 10 stars votes refers to stars = 10; highest rating refers to Max(rating); number of votes refers to SUM(votes);
Question: How many 10 star votes did the top 4 episodes with the highest rating received?
SQL: SELECT sum(episode.votes) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE vote.stars = 10 ORDER BY episode.rating DESC LIMIT 4;
Database: simpson_episodes
Note: "No Loan Again, Naturally" is the title of episode; votes of no more than 50 refers to votes < 50; number of stars refers to SUM(stars);
Question: In "No Loan Again, Naturally", how many stars received votes of no more than 50?
SQL: SELECT count(*) FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'No Loan Again, Naturally' AND vote.votes < 50;
Database: simpson_episodes
Note: award winner refers to result = 'Winner'; 'USA' is the birth_country;
Question: How many award winners are from the USA?
SQL: SELECT count(*) FROM person INNER JOIN award ON person.name = award.person WHERE person.birth_country = 'USA' AND award.result = 'Winner';
Database: simpson_episodes
Note: in season 20 episode 11 refers to episode_id = 'S20-E11'; 'Doofus' is the nickname of person; include in credit list refers to credited = 'true';
Question: In Season 20 Episode 11, how many times was Doofus included in the credit list?
SQL: SELECT count(*) FROM person INNER JOIN credit ON person.name = credit.person WHERE person.nickname = 'Doofus' AND credit.credited = 'true' AND credit.episode_id = 'S20-E11';
Database: simpson_episodes
Note: won refers to result = 'Winner'; first award refers to Min(year);
Question: What was the first award won by the cast or crew member of the show? Give the name of the person who won the said award.
SQL: SELECT award.award, person.name FROM person INNER JOIN award ON person.name = award.person WHERE award.result = 'Winner' ORDER BY award.year LIMIT 1;
Database: simpson_episodes
Note: "Sex, Pies and Idiot Scrapes" is the title of episode; 9 star score refers to stars = 9; percentage refers to percent;
Question: In "Sex, Pies and Idiot Scrapes", how many percentage of votes did the 9 star score has?
SQL: SELECT vote.percent FROM episode INNER JOIN vote ON vote.episode_id = episode.episode_id WHERE episode.title = 'Sex, Pies and Idiot Scrapes' AND vote.stars = 9;
Database: simpson_episodes
Note: won the award refers to result = 'Winner'; in 2009 refers to year = 2009;
Question: List the award name and persons who won the award in 2009.
SQL: SELECT award, person FROM award WHERE RESULT = 'Winner' AND substr(YEAR, 1, 4) = '2009';
Database: simpson_episodes
Note: "Los Angeles" is the birth_place; 1.8 m and above in height refers to height_meters >= 1.8;
Question: Among the casts who were born in Los Angeles, describe the name and birth date of who have 1.8 m and above in height.
SQL: SELECT name, birthdate FROM person WHERE birth_place = 'Los Angeles' AND height_meters >= 1.8;
Database: simpson_episodes
Note: episode number refers to episode; aired in refers to air_date; October refers to Substr(air_date, 6, 2) = '10': 2008 refers to Substr(air_date, 0, 5) = '2008';
Question: Provide the episode number, title and rating of which were aired in October, 2008.
SQL: SELECT episode, title, rating FROM episode WHERE substr(air_date, 1, 7) LIKE '2008-10%';
Database: simpson_episodes
Note: "Homer simpson 20" is the character; "Winner" is the result; award name refers to award;
Question: Write down the award ID, award name and winner for character named "Homer simpson 20".
SQL: SELECT award.award_id, award.award, award.person FROM award INNER JOIN character_award ON award.award_id = character_award.award_id WHERE character_award.character = 'Homer Simpson' AND award.result = 'Winner';
Database: simpson_episodes
Note: "Billy Kimball" is the person; award name refers to award; credited category refers to category; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa;
Question: List down the award name, result, credit category and credited status of the "Billy Kimball".
SQL: SELECT DISTINCT award.award, award.result, credit.category, credit.credited FROM award INNER JOIN credit ON credit.episode_id = award.episode_id WHERE credit.person = 'Billy Kimball';
Database: simpson_episodes
Note: "assistant director" is the role of person; 'S20-E13' is the episode_id; credited status refers to credited; credited = 'true' means the person is included in the credit list and vice versa;
Question: Name the person, award, organization, result and credited status of the assistant director in S20-E13.
SQL: SELECT award.person, award.award, award.organization, award.result, credit.credited FROM award INNER JOIN credit ON credit.episode_id = award.episode_id WHERE credit.episode_id = 'S20-E13' AND credit.role = 'assistant director';
Database: simpson_episodes
Note: height refers to height_meters; not in credit list refers to credited = ''; category of casting refers to category = 'Casting Department';
Question: Describe the birth country, height and person name who were not included in credit list with category of casting.
SQL: SELECT person.birth_country, person.height_meters, person.name FROM person INNER JOIN credit ON person.name = credit.person WHERE credit.category = 'Cast' AND credit.credited = 'false';
Database: simpson_episodes
Note: nominee refers to result = 'Nominee';
Question: List the nominee, keywords and episode ID of the title "The Good, the Sad and the Drugly".
SQL: SELECT award.person, keyword.keyword, keyword.episode_id FROM keyword INNER JOIN episode ON keyword.episode_id = episode.episode_id INNER JOIN award ON episode.episode_id = award.episode_id WHERE episode.title = 'The Good, the Sad and the Drugly' AND award.result = 'Nominee';
Database: simpson_episodes
Note: best rating scale refers to stars = 10;
Question: What is the voting numbers and percentage of the best rating scale of the episode which had keyword of "arab stereotype"?
SQL: SELECT vote.votes, vote.percent FROM keyword INNER JOIN vote ON keyword.episode_id = vote.episode_id WHERE keyword.keyword = 'arab stereotype' AND vote.stars = 10;
Database: simpson_episodes
Note: held by Jupiter award refers to organization = 'Jupiter award'; won the award refers to result = 'Winner';
Question: For the episode who won the award held by Jupiter Award, describe award name, aired date and rating of that episode.
SQL: SELECT award.award, episode.air_date, episode.rating FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE award.organization = 'Jupiter Award' AND award.result = 'Winner';
Database: simpson_episodes
Note: star classification of worst refers to stars = 1; most number of votes refers to MAX(votes);
Question: Mention the episode ID, title and any three keywords of the episode which get the most number of votes in star classification of worst.
SQL: SELECT DISTINCT vote.episode_id, episode.title, keyword.keyword FROM keyword INNER JOIN episode ON keyword.episode_id = episode.episode_id INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE vote.stars = 1 ORDER BY vote.votes DESC LIMIT 3;
Database: simpson_episodes
Note: excellent rating refers to 7 <= rating <= 10; aired in 2008 refers to SUBSTRACT(air_date, 0, 5) = '2008'; who were nominated refers to result = 'Nominee';
Question: Among the episodes with excellent rating which were aired in 2008, describe the title, episode's image, award name and person who were nominated.
SQL: SELECT episode.title, episode.episode_image, award.award, award.person FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE episode.rating BETWEEN 7 AND 10 AND substr(episode.air_date, 1, 4) = '2008' AND award.result = 'Nominee';
Database: simpson_episodes
Question: Describe the award title, person and character name of the award ID 326.
SQL: SELECT DISTINCT award.award, award.person, character_award.character FROM award INNER JOIN character_award ON award.award_id = character_award.award_id WHERE character_award.award_id = 326;
Database: simpson_episodes
Note: age in 2022 refers to SUBTRACT(2022, substr(birthdate, 0, 5)); oldest refers to MIN(birthdate);
Question: Describe name, birth country, role in episode and age in 2022 of the oldest crew member..
SQL: SELECT person.name, person.birth_place, credit.role, 2022 - cast(substr(person.birthdate, 1, 4) AS int) AS age FROM person INNER JOIN credit ON person.name = credit.person WHERE person.birthdate IS NOT NULL ORDER BY person.birthdate LIMIT 1;