Chinastark/bird_dataset huggingface dataset:
Database: law_episode
Note: credited refers to credited = 'true';
Question: For how many times was Park Dietz credited?
SQL: SELECT count(person.person_id) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE credit.credited = 'true' AND person.name = 'Park Dietz'
Database: law_episode
Note: credited refers to credited = 'true';
Question: Please list the titles of all the episodes in which Park Dietz was credited.
SQL: SELECT episode.title FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE credit.credited = 'true' AND person.name = 'Park Dietz'
Database: law_episode
Note: episode tt0629204 refers to episode_id = 'tt0629204'; credited refers to credited = 'true'; not credited refers to credited = '';
Question: Was Anthony Azzara's role in episode tt0629204 displayed in the credits at the end of the episode?
SQL: SELECT credit.credited FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'Anthony Azzara' AND credit.episode_id = 'tt0629204'
Database: law_episode
Note: episode Disciple refers to title = 'Disciple';
Question: How many keywords are there in the episode Disciple?
SQL: SELECT count(keyword.keyword) FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.title = 'Disciple'
Database: law_episode
Note: the most refers to max(votes); 1 star refers to stars = '1';
Question: Which episode got the most 1 star votes? Give its title.
SQL: SELECT episode.title FROM vote INNER JOIN episode ON episode.episode_id = vote.episode_id WHERE vote.stars = 1 ORDER BY vote.votes DESC LIMIT 1
Database: law_episode
Note: Law and Order refers to series = 'Law and Order';
Question: How many nominations did Law and Order season 9, episode 20 get?
SQL: SELECT count(award.award_id) FROM episode INNER JOIN award ON episode.episode_id = award.episode_id WHERE award.series = 'Law and Order' AND episode.season = 9 AND episode.episode = 20
Database: law_episode
Note: Law and Order refers to series = 'Law and Order'; included in the credit refers to credited = 'true';
Question: For season 9, episode 17 of the show Law and Order, how many roles have been included in the credit?
SQL: SELECT count(credit.role) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.series = 'Law and Order' AND episode.season = 9 AND episode.episode = 17 AND credit.credited = 'true'
Database: law_episode
Note: description of what happened refers to summary; award no.296 refers to award_id = '296';
Question: Describe what happened in the episode of award no.296.
SQL: SELECT episode.summary FROM episode INNER JOIN award ON episode.episode_id = award.episode_id WHERE award.award_id = 296
Database: law_episode
Question: Which role did Joseph Blair play in the show?
SQL: SELECT credit.role FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'Joseph Blair'
Database: law_episode
Question: How many awards has Rene Balcer been nominated for?
SQL: SELECT count(award.award_id) FROM person INNER JOIN award ON person.person_id = award.person_id WHERE person.name = 'Rene Balcer'
Database: law_episode
Note: the most votes refers to max(votes);
Question: For the episode with the most votes, give its air date.
SQL: SELECT episode.air_date FROM vote INNER JOIN episode ON episode.episode_id = vote.episode_id GROUP BY episode.episode_id ORDER BY sum(vote.votes) DESC LIMIT 1
Database: law_episode
Note: award no.313 refers to award_id = '313'; full name refers to name;
Question: Who was nominated for award no.313? Give the full name.
SQL: SELECT person.name FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.award_id = 313
Database: law_episode
Question: How many episodes did J.K. Simmons' role appear on the show?
SQL: SELECT count(credit.role) FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'J.K. Simmons'
Database: law_episode
Note: 9-star vote refers to stars = '9'; episode Sideshow refers to title = 'Sideshow';
Question: Display the number of 9-star votes the episode Sideshow received.
SQL: SELECT vote.votes FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE vote.stars = 9 AND episode.title = 'Sideshow'
Database: law_episode
Note: "Refuge: Part 1" episode refers to title = 'Refuge: Part 1'; "Shield" episode refers to title = 'Shield'; times = divide(count(keyword where title = 'Refuge: Part 1'), count(keyword where title = 'Shield'));
Question: How many times is the number of keywords in "Refuge: Part 1" episode than "Shield" episode?
SQL: SELECT cast(sum(CASE WHEN episode.title = 'Refuge: Part 1' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN episode.title = 'Shield' THEN 1 ELSE 0 END) FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id
Database: law_episode
Note: appeared in the credit refers to credited = 'TRUE'; from the 185th to the 193rd episode refers to number_in_series between 185 and 193; cast refers to category = 'Cast'; average number = divide(count(episode_id), 9);
Question: Calculate the average number of cast members that appeared in the credit from the 185th to the 193rd episode.
SQL: SELECT cast(count(credit.episode_id) AS REAL) / (193 - 185 + 1) FROM credit INNER JOIN episode ON credit.episode_id = episode.episode_id WHERE credit.category = 'Cast' AND credit.credited = 'true' AND episode.number_in_series BETWEEN 185 AND 193
Database: law_episode
Note: not credited refers to credited = ''; episode tt0629391 refers to episode_id = 'tt0629391';
Question: What are the names of the person that were not credited at the end of episode tt0629391?
SQL: SELECT person.name FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.credited = 'false' AND credit.episode_id = 'tt0629391'
Database: law_episode
Note: won refers to result = 'Winner'; at least 3 awards refers to count(result) > 3;
Question: How many people have won at least 3 awards?
SQL: SELECT count(person.person_id) FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.result = 'Winner' GROUP BY person.person_id HAVING count(award.award_id) >= 3
Database: law_episode
Note: who refers to name; script supervisor refers to role = 'script supervisor'; episode tt0629204 refers to episode_id = 'tt0629204';
Question: Who is the script supervisor of the series in episode tt0629204?
SQL: SELECT person.name FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.episode_id = 'tt0629204' AND credit.role = 'script supervisor'
Database: law_episode
Note: been nominated refers to result = 'Nominee';
Question: How many awards has Julia Roberts been nominated for?
SQL: SELECT count(award.award_id) FROM person INNER JOIN award ON person.person_id = award.person_id WHERE person.name = 'Julia Roberts' AND award.result = 'Nominee'
Database: law_episode
Note: who refers to name; the tallest refers to max(height_meters); camera operator refers to role = 'camera operator';
Question: Who is the tallest camera operator?
SQL: SELECT person.name FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.role = 'camera operator' ORDER BY person.height_meters DESC LIMIT 1
Database: law_episode
Note: born in Canada refers to birth_country = 'Canada'; in 1999 refers to year = 1999;
Question: How many people, who were born in Canada, won an award in 1999?
SQL: SELECT count(person.person_id) FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.year = 1999 AND person.birth_country = 'Canada'
Database: law_episode
Note: the most enjoyed refers max(rating); 10-star refers to stars = 10;
Question: How many people gave the most enjoyed episode a 10-star rating?
SQL: SELECT count(episode.episode_id) FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE vote.stars = 10
Database: law_episode
Note: "Shield" episode refers to title = 'Shield';
Question: What are the keywords of the "Shield" episode?
SQL: SELECT keyword.keyword FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.title = 'Shield'
Database: law_episode
Note: the "True North" episode refers to title = 'True North'; 1-star refers to stars = 1; percentage = divide(count(episode_id where stars = 1), count(episode_id)) * 100% where title = 'True North';
Question: What is the percentage of people who gave the "True North" episode a 1-star rating?
SQL: SELECT cast(sum(CASE WHEN vote.stars = 1 THEN 1 ELSE 0 END) AS REAL) * 100 / count(episode.episode_id) FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE episode.title = 'True North' AND episode.episode_id = 'tt0629477'
Database: law_episode
Note: the highest number of keywords refers to max(count(keyword));
Question: What is the title of the episode with the highest number of keywords?
SQL: SELECT episode.title FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id GROUP BY episode.episode_id ORDER BY count(keyword.keyword) DESC LIMIT 1
Database: law_episode
Note: aired in 1998 refers to air_date like '1998%'; won refers to result = 'Winner'; International Monitor awards refers to organization = 'International Monitor awards';
Question: Among the episodes that were aired in 1998, how many won an International Monitor Awards?
SQL: SELECT count(episode.episode_id) FROM episode INNER JOIN award ON episode.episode_id = award.episode_id WHERE strftime('%Y', episode.air_date) = '1998' AND award.organization = 'International Monitor Awards' AND award.result = 'Winner'
Database: law_episode
Note: titled "Agony" refers to title = 'Agony'; win an award refers to result = 'Winner';
Question: How many times did the episode titled "Agony" win an award?
SQL: SELECT count(award.award_id) FROM episode INNER JOIN award ON episode.episode_id = award.episode_id WHERE episode.title = 'Agony' AND award.result = 'Winner'
Database: law_episode
Note: the 9th season refers to season = 9; Law and Order refers to series = 'Law and Order'; cast refers to category = 'Cast'; average number of casts per season = divide(count(person_id), count(episode_id));
Question: How many episodes are there in the 9th season of Law and Order? Calculate the average number of casts per season of the said series.
SQL: SELECT sum(CASE WHEN episode.season = 9 THEN 1 ELSE 0 END) AS num , cast(sum(CASE WHEN episode.season = 9 THEN 1 ELSE 0 END) AS REAL) / count(credit.episode_id) FROM credit INNER JOIN episode ON credit.episode_id = episode.episode_id WHERE credit.category = 'Cast' AND episode.series = 'Law and Order'
Database: law_episode
Note: the 2nd-highest number of votes refers to second max(votes);
Question: What are the keywords of the episode which received the 2nd-highest number of votes?
SQL: SELECT keyword.keyword FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id WHERE episode.votes NOT IN ( SELECT max(episode.votes) FROM episode INNER JOIN keyword ON episode.episode_id = keyword.episode_id ) ORDER BY episode.votes DESC LIMIT 1
Database: law_episode
Note: the "Agony" refers to title = 'Agony'; win refers to result = 'Winner';
Question: How many awards did the "Agony" win?
SQL: SELECT count(award.award) FROM episode INNER JOIN award ON episode.episode_id = award.episode_id WHERE episode.title = 'Agony' AND award.result = 'Winner'
Database: law_episode
Note: who refers to name; narrator refers to role = 'Narrator'; the "Flight" episode refers to title = 'Flight';
Question: Who is the narrator of the "Flight" episode?
SQL: SELECT person.name FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE episode.title = 'Flight' AND credit.role = 'Narrator'
Database: law_episode
Note: win refers to result = 'Winner'; the most awards refers to max(count(award_id));
Question: In which organization did Constantine Makris win the most awards?
SQL: SELECT award.organization FROM person INNER JOIN award ON person.person_id = award.person_id WHERE person.name = 'Constantine Makris' AND award.result = 'Winner' GROUP BY award.organization ORDER BY count(award.award_id) DESC LIMIT 1
Database: law_episode
Note: who refers to name; stunt coordinator refers to role = 'stunt coordinator';
Question: Who is the stunt coordinator in episode 3?
SQL: SELECT person.name FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE episode.episode = 3 AND credit.role = 'stunt coordinator'
Database: law_episode
Note: not credited refers to credited = ''; the "Admissions" episode refers to title = 'Admissions';
Question: How many people were not credited at the end of the "Admissions" episode?
SQL: SELECT count(credit.person_id) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.title = 'Admissions' AND credit.credited = 'false'
Database: law_episode
Note: the highest number of crews refers to max(count(person_id)); in the Art Department refers to category = 'Art Department';
Question: What is the title of the episode that has the highest number of crews in the Art Department?
SQL: SELECT episode.title FROM credit INNER JOIN episode ON credit.episode_id = episode.episode_id WHERE credit.category = 'Art Department' GROUP BY episode.episode_id ORDER BY count(credit.category) DESC LIMIT 1
Database: law_episode
Question: How many roles did Julia Roberts play in the series?
SQL: SELECT count(credit.role) FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'Julia Roberts'
Database: law_episode
Note: no less than 30 votes refers to votes >= 30; 10-star rating refers to stars = 10;
Question: What are the titles of the top 3 episodes that received no less than 30 votes in its 10-star rating?
SQL: SELECT episode.title FROM vote INNER JOIN episode ON episode.episode_id = vote.episode_id WHERE vote.votes >= 30 AND vote.stars = 10 ORDER BY vote.votes DESC LIMIT 3
Database: law_episode
Note: who refers to name; the youngest person refers to max(birthdate); a "clerk" role refers to role = 'Clerk';
Question: Who is the youngest person to ever play a "clerk" role in the series?
SQL: SELECT person.name FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.role = 'Clerk' AND person.birthdate IS NOT NULL ORDER BY person.birthdate LIMIT 1
Database: law_episode
Note: did not enjoy refers to stars = 1; the finale episode refers to episode = 24;
Question: How many people did not enjoy the finale episode?
SQL: SELECT count(episode.episode_id) FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE episode.episode = 24 AND vote.stars = 1
Database: law_episode
Note: cast member refers to category = 'Cast';
Question: List the names of all the cast members in the series.
SQL: SELECT person.name FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.category = 'Cast'
Database: law_episode
Note: who refers to name; appear the most refers to max(count(person_id)); percentage = divide(count(person_id where max(count(person_id))), count(person_id)) * 100%;
Question: Who is the person who appeared the most in the series? Calculate in percentage how many times he or she appeared.
SQL: SELECT person.person_id, cast(count(person.person_id) AS REAL) * 100 / ( SELECT count(person.person_id) AS num FROM credit INNER JOIN person ON person.person_id = credit.person_id ) AS per FROM credit INNER JOIN person ON person.person_id = credit.person_id GROUP BY person.person_id ORDER BY count(person.person_id) DESC LIMIT 1
Database: law_episode
Note: episode refers to award; the Primetime Emmy awards refers to award_category like 'Primetime Emmy';
Question: Which episodes of the Law & Order have been nominated for the Primetime Emmy Awards?
SQL: SELECT DISTINCT episode_id FROM award WHERE award_category = 'Primetime Emmy'
Database: law_episode
Note: have not won any award refers to result = 'Nominee';
Question: How many episodes have not won any Law & Order series awards?
SQL: SELECT count(award_id) FROM award WHERE RESULT = 'Nominee'
Database: law_episode
Note: have not been credited refers to credited = '';
Question: What roles have not been credited at the end of the episodes?
SQL: SELECT DISTINCT ROLE FROM credit WHERE credited = 'false'
Database: law_episode
Note: worst rated refers to min(rating);
Question: What is the title of the 3 worst rated episodes?
SQL: SELECT title FROM episode ORDER BY rating LIMIT 3
Database: law_episode
Note: full place of birth refers to birth_place, birth_region; Rene Chenevert Balcer refers to birth_name = 'Rene Chenevert Balcer';
Question: What is the full place of birth of Rene Chenevert Balcer?
SQL: SELECT birth_place, birth_region FROM person WHERE birth_name = 'Rene Chenevert Balcer'
Database: law_episode
Note: born in the USA refers to birth_country = 'USA';
Question: What is the name of the actors born in the USA?
SQL: SELECT name FROM person WHERE birth_country = 'USA'
Database: law_episode
Note: least enjoyed refers to stars = 1;
Question: What is the title of the episodes that were least enjoyed?
SQL: SELECT episode.title FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE vote.stars = 1
Database: law_episode
Note: won an award refers to result = 'Winner'; role as director refers to role = 'director';
Question: What are the names of the two people who won an award for their role as directors?
SQL: SELECT person.name FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.result = 'Winner' AND award.role = 'director'
Database: law_episode
Note: the episode titled Juvenile refers to title = 'Juvenile';
Question: How many votes did the episode titled Juvenile get?
SQL: SELECT sum(vote.votes) FROM episode INNER JOIN vote ON episode.episode_id = vote.episode_id WHERE episode.title = 'Juvenile'
Database: law_episode
Note: which episode refers to title; not credited refers to credited = '';
Question: In which episodes was Anthony Azzara not credited?
SQL: SELECT episode.title FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE credit.credited = 'false' AND person.name = 'Anthony Azzara'
Database: law_episode
Note: titled DWB refers to title = 'DWB'; get an award refers to result = 'Winner';
Question: In what year did the episodes titled DWB get an award?
SQL: SELECT DISTINCT award.year FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE episode.title = 'DWB' AND award.result = 'Winner'
Database: law_episode
Note: region refers to birth_region; assistant location manager refers to role = 'assistant location manager';
Question: In which region were the assistant location managers born?
SQL: SELECT person.birth_region FROM credit INNER JOIN person ON person.person_id = credit.person_id WHERE credit.role = 'president of NBC West Coast'
Database: law_episode
Question: How many stars did the episodes in which Donna Villella worked?
SQL: SELECT count(person.person_id) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'Donna Villella'
Database: law_episode
Note: nominated refers to result = 'Nominee';
Question: What role was Julia Roberts nominated for?
SQL: SELECT award.role FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.result = 'Nominee' AND person.name = 'Julia Roberts'
Database: law_episode
Note: the tallest refers to max(height_meters);
Question: What role does the tallest person play?
SQL: SELECT credit.role FROM person INNER JOIN credit ON person.person_id = credit.person_id INNER JOIN award ON credit.episode_id = award.episode_id ORDER BY person.height_meters DESC LIMIT 1
Database: law_episode
Note: the most nominations refers to max(count(episode_id where result = 'Nominee'));
Question: What is the title of the episode with the most nominations?
SQL: SELECT episode.title FROM award INNER JOIN episode ON award.episode_id = episode.episode_id WHERE award.result = 'Nominee' GROUP BY episode.episode_id ORDER BY count(award.result) DESC LIMIT 1
Database: law_episode
Question: What was the rating of the episodes that Jace Alexander worked on?
SQL: SELECT episode.rating FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE person.name = 'Jace Alexander'
Database: law_episode
Question: What are the names of all the people who worked on episode 19 of season 9?
SQL: SELECT person.name FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id INNER JOIN person ON person.person_id = credit.person_id WHERE episode.episode = 19 AND episode.season = 9
Database: law_episode
Note: average star rating = divide(sum(stars), count(episode_id)) where name = 'Jim Bracchitta';
Question: What is the average star rating of the episodes Jim Bracchitta has worked on?
SQL: SELECT cast(sum(vote.stars) AS REAL) / count(credit.episode_id) FROM person INNER JOIN credit ON person.person_id = credit.person_id INNER JOIN vote ON credit.episode_id = vote.episode_id WHERE vote.stars = 1 AND person.name = 'Jim Bracchitta'
Database: law_episode
Note: the True North episode refers to title = 'True North'; additional crew refers to role = 'Additional Crew'; percentage = divide(count(episode_id where role = 'Additional Crew'), count(episode_id)) * 100% where title = 'True North';
Question: What percentage of people have worked on the True North episode as additional crew?
SQL: SELECT cast(sum(CASE WHEN credit.role = 'Additional Crew' THEN 1 ELSE 0 END) AS REAL ) * 100 / count(episode.episode_id) FROM episode INNER JOIN credit ON episode.episode_id = credit.episode_id WHERE episode.title = 'True North'
Database: law_episode
Note: 72 10-star votes refers to stars = 10 and votes = 72;
Question: Write down the title, summary, and air date of the episode that garnered 72 10-star votes.
SQL: SELECT episode.title, episode.summary, episode.air_date FROM vote INNER JOIN episode ON episode.episode_id = vote.episode_id WHERE vote.stars = 10 AND vote.votes = 72
Database: law_episode
Note: 6-star vote refers to stars = 6;
Question: How many 6-star votes did episode 12 get? Please include the air date and rating.
SQL: SELECT episode.air_date, episode.rating FROM vote INNER JOIN episode ON episode.episode_id = vote.episode_id WHERE vote.stars = 6 AND episode.episode = 12
Database: law_episode
Note: the Best Television episode award refers to award = 'Best Television episode'; the Edgar category refers to award_category = 'Edgar'; in 2000 refers to year = 2000;
Question: Who is the winner of the Best Television Episode award for the Edgar category in 2000? Include his or her name and role.
SQL: SELECT person.name, award.role FROM person INNER JOIN award ON person.person_id = award.person_id WHERE award.year = 2000 AND award.award_category = 'Edgar' AND award.award = 'Best Television Episode'
Database: law_episode
Note: Rene Balcer refers to name = 'Rene Balcer'; the winner refers to result = 'Winner';
Question: Write down the organization, year, award, and award category in which Rene Balcer is the winner.
SQL: SELECT award.organization, award.year, award.award, award.award_category FROM person INNER JOIN award ON person.person_id = award.person_id WHERE person.name = 'Rene Balcer' AND award.result = 'Winner'