1sf/bird-sql-train-with-schema huggingface dataset:
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: How many times was episode 20 of the Law and Order series nominated for the Primetime Emmy Awards in 1999?
Evidence: nominated refers to result = 'nominee'; the Law and Order series refers to series = 'Law and Order'; the Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; in 1999 refers to year = 1999
SQL: SELECT COUNT(T2.award_id) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.year = 1999 AND T2.result = 'Nominee' AND T1.episode = 20 AND T2.organization = 'Primetime Emmy Awards' AND T1.series = 'Law and Order'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: On what episode did Julia Roberts win the "Outstanding Guest Actress in a Drama Series" award during the 1999 Primetime Emmy Awards? Tell me her role.
Evidence: win refers to result = 'Winner'; the "Outstanding Guest Actress in a Drama Series" award refers to award = 'Outstanding Guest Actress in a Drama Series'; the 1999 refers to year = 1999; Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'
SQL: SELECT T3.episode_id, T2.role FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id WHERE T2.year = 1999 AND T2.award = 'Outstanding Guest Actress in a Drama Series' AND T2.organization = 'Primetime Emmy Awards' AND T1.name = 'Julia Roberts' AND T2.result = 'Nominee'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: List the titles and air dates of episodes that were produced by Billy Fox.
Evidence: produced refers to role = 'producer'
SQL: SELECT T1.title, T1.air_date FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T2.category = 'Produced by' AND T2.role = 'producer' AND T3.name = 'Billy Fox'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: Among the American casts, how many were uncredited on episode ID tt0629228?
Evidence: American refers to birth_country = 'USA'; cast refers to category = 'Cast'; uncredited refers to credited = ''
SQL: SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T1.episode_id = 'tt0629228' AND T1.category = 'Cast' AND T1.credited = 'false' AND T2.birth_country = 'USA'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What was the role of Jason Kuschner in episode 9?
SQL: SELECT T1.role FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 9 AND T2.name = 'Jason Kuschner'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: Who played the role of the "president of NBC West Coast" in the first episode?
Evidence: who refers to name; the role of the "president of NBC West Coast" refers to role = 'president of NBC West Coast'; the first episode refers to episode = 1
SQL: SELECT T2.name FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.episode = 1 AND T1.role = 'president of NBC West Coast'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: List down the titles of the top 3 episodes, from highest to lowest, in terms of their weighted stars.
Evidence: weighted stars = divide(sum(stars, percent), 100)
SQL: SELECT T2.title FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars BETWEEN 1 AND 10 GROUP BY T2.title ORDER BY CAST(SUM(T1.stars * T1.percent) AS REAL) / 100 DESC LIMIT 3
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the ratio of American casts on episode 2 of the series? Please include their roles.
Evidence: American refers to birth_country = 'USA'; cast refers to category = 'Cast'; ratio = divide(count(person_id where birth_country = 'USA'), total(category)) where category = 'Cast'
SQL: SELECT CAST(SUM(CASE WHEN T2.category = 'Cast' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.category), T1.role FROM Award AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T2.episode_id = T3.episode_id INNER JOIN Person AS T4 ON T2.person_id = T4.person_id WHERE T3.episode = 2 AND T4.birth_country = 'USA'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: How many people from Canada are nominated for an award?
Evidence: from Canada refers to birth_country = Canada; nominated refers to award is NOT NULL
SQL: SELECT COUNT(T1.person_id) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id WHERE T1.birth_country = 'Canada'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: How many episodes are credited to Jerry Orbach?
SQL: SELECT COUNT(T2.person_id) FROM Credit AS T1 INNER JOIN Person AS T2 ON T2.person_id = T1.person_id WHERE T2.name = 'Jerry Orbach'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: List out all the credit names for episode 9.
Evidence: credit name refers to name
SQL: SELECT T3.name FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T3.person_id = T2.person_id WHERE T1.episode = 9
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: List out all award titles nominated for episode 20.
Evidence: award title refers to title; nominated refers to result = 'Winner' or result = 'Nominee'
SQL: SELECT T2.award FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode = 20 AND T2.result IN ('Winner', 'Nominee')
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: Which role have won at least two awards for the entire season and list out the name?
Evidence: at least two awards refers to count(role) >1
SQL: SELECT T1.name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.person_id = T2.person_id GROUP BY T2.role HAVING COUNT(T2.award_id) > 1
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: List out director names that received an award along with the episode number.
Evidence: director refers to role = 'director'; received an award refers to result = 'Winner'; episode number refers to episode
SQL: SELECT T3.name, T1.episode_id FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Person AS T3 ON T2.person_id = T3.person_id WHERE T2.role = 'director' AND T2.result = 'Winner'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: Which episodes are nominated for an awards but not win?
Evidence: nominated for an award but not win refers to result = 'Nominee'
SQL: SELECT T1.episode FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Nominee'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the average rating for each episode in season 9?
Evidence: average rating = divide(sum(rating), count(episode_id))
SQL: SELECT SUM(rating) / COUNT(episode_id) FROM Episode WHERE season = 9
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the difference of 10 stars votes between the first episode and the last episode?
Evidence: the first episode refers to episode = 1; the last episode refers to episode = 24; 10 stars vote refers to stars = 10; the difference = subtract(votes where episode = 1, votes where episode = 24) where stars = 10
SQL: SELECT SUM(CASE WHEN T2.episode = 24 THEN T1.votes ELSE 0 END) - SUM(CASE WHEN T2.episode = 1 THEN T1.votes ELSE 0 END) FROM Vote AS T1 INNER JOIN Episode AS T2 ON T2.episode_id = T1.episode_id WHERE T1.stars = 10
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the episode rating with the most award won?
Evidence: the most award won refers to max(episode_id where result = 'Winner')
SQL: SELECT T1.rating FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id WHERE T2.result = 'Winner' GROUP BY T1.episode_id ORDER BY COUNT(T2.award_id) DESC LIMIT 1
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: How many credits have been displayed from episode 1 until 10?
Evidence: credit displayed refers to credited = 'true'; from episode 1 until 10 refers to episode > = 1 AND episode < = 10
SQL: SELECT COUNT(T1.person_id) FROM Credit AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.credited = 'true' AND T2.episode BETWEEN 1 AND 10
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the episode that has mafia keyword?
Evidence: mafia keyword refers to Keyword = 'mafia'
SQL: SELECT T1.episode FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.Keyword = 'mafia'
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the average star with highest percentage for episodes that have received award?
Evidence: received award refers to result = 'Winner'; the highest percentage refers to max(percent); average star = divide(sum(stars), count(episode_id))
SQL: SELECT T2.person_id FROM Vote AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.percent DESC LIMIT 1
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: What is the average ranking episodes that are nominated for an award?
Evidence: average ranking = divide(sum(rating), sum(episode_id))
SQL: SELECT SUM(T1.rating) / COUNT(T1.episode) FROM Episode AS T1 INNER JOIN Award AS T2 ON T1.episode_id = T2.episode_id
Database: law_episode
Tables: Episode, Keyword, Person, Award, Credit, Vote
Columns (table index, column name): -1, *, 0, episode_id, 0, series, 0, season, 0, episode, 0, number_in_series, 0, title, 0, summary, 0, air_date, 0, episode_image, 0, rating, 0, votes, 1, episode_id, 1, keyword, 2, person_id, 2, name, 2, birthdate, 2, birth_name, 2, birth_place, 2, birth_region, 2, birth_country, 2, height_meters, 2, nickname, 3, award_id, 3, organization, 3, year, 3, award_category, 3, award, 3, series, 3, episode_id, 3, person_id, 3, role, 3, result, 4, episode_id, 4, person_id, 4, category, 4, role, 4, credited, 5, episode_id, 5, stars, 5, votes, 5, percent
Question: How many winners have been awarded a Television award by the "American Bar Association Silver Gavel Awards for Media and the Arts"?
Evidence: winner refers to result = 'Winner'; Television award refers to award = 'Television'; the "American Bar Association Silver Gavel Awards for Media and the Arts" refers to organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'
SQL: SELECT COUNT(award_id) FROM Award WHERE result = 'Winner' AND award = 'Television' AND organization = 'American Bar Association Silver Gavel Awards for Media and the Arts'