db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What are the titles of the episodes that have received more 7-star votes than the season average?
SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 7 AND T2.votes > 0.7 * ( SELECT CAST(COUNT(votes) AS REAL) / COUNT(CASE WHEN stars = 7 THEN 1 ELSE 0 END) FROM Vote );
episodes that have received more 7-star votes than the season average refers to votes > DIVIDE(SUM(votes), COUNT(stars = 7))
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What percentage of votes are from the nominated episodes?
SELECT CAST(SUM(CASE WHEN T1.result = 'Nominee' THEN T2.votes ELSE 0 END) AS REAL) * 100 / SUM(T2.votes) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id;
nominated episodes refers to result = 'Nominee'; percentage of votes = DIVIDE(SUM(result = 'Nominee), SUM(Votes)) as percentage
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down person's name who has nickname.
SELECT name FROM Person WHERE nickname IS NOT NULL;
has nickname refers to nickname is NOT NULL
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Which country has the tallest person in the crew?
SELECT birth_country FROM Person ORDER BY height_meters DESC LIMIT 1;
country refers to birth_country; tallest person refers to max(height_meters)
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the average height of people from USA?
SELECT AVG(height_meters) FROM Person WHERE birth_country = 'USA';
people from USA refers to birth_country = 'USA'; average height = AVG(height_meters)
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Calculate the percentage of people who were born after 1970 and from California.
SELECT CAST(SUM(CASE WHEN birth_region = 'California' AND SUBSTR(birthdate, 1, 4) > '1970' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(birthdate) FROM Person;
born after 1970 refers to birthdate > 1970; from California refers to birth_region = 'California'; percentage = divide(count(birthdate > 1970 and birth_region = 'California'), total(birthdate)) * 100%
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many people were not born in Connecticut, USA?
SELECT COUNT(name) FROM Person WHERE birth_region != 'Connecticut' AND birth_country != 'USA';
not born in Connecticut, USA refers to birth_region ! = 'Connecticut' and birth_country ! = 'USA'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down the title of episode S20-E1, S20-E2 & S20-E3.
SELECT title FROM Episode WHERE episode_id IN ('S20-E1', 'S20-E2', 'S20-E3');
episode S20-E1, S20-E2 & S20-E3 refers to episode_id = 'S20-E1' and episode_id = 'S20-E2' and episode_id = 'S20-E3'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Write down the website address which stores the episode image of episode 5.
SELECT episode_image FROM Episode WHERE episode = 5;
website address refers to episode_image
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
State the number of votes for episode with rating of 7 and above.
SELECT votes FROM Episode WHERE rating > 7;
rating of 7 and above refers to rating > 7.0
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many title's crew members are working from Casting Department?
SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.category = 'Casting Department';
working from Casting Department refers to category = 'Casting Department'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many additional timers were born in USA?
SELECT COUNT(*) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.role = 'additional timer' AND T1.birth_country = 'USA';
additional timers refers to role = 'additional timer'; born in USA refers to birth_country = 'USA'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many people who were born after 1970 are animation executive producer?
SELECT COUNT(*) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE STRFTIME(T1.birthdate) > '1970' AND T2.role = 'animation executive producer';
born after 1980 refers to birthdate > 1970; assistant to the producers refers to role = 'animation executive producer'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Write down the summary of episode whereby it has crew members that are not included in the credit list.
SELECT T1.summary FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'false';
are not included in the credit list refers to credited = ''
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down the rating of episodes that were produced by Jason Bikowski.
SELECT T1.rating FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Jason Bikowski';
produced by Jason Bikowski refers to person = 'Jason Bikowski'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the average heights of crew members from Animation Department?
SELECT AVG(T1.height_meters) FROM Person AS T1 INNER JOIN Credit AS T2 ON T1.name = T2.person WHERE T2.category = 'Animation Department';
from Animation Department refers to category = 'Animation Department'; AVG(height_meters) where category = 'Animation Department'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the character that won the award in Primetime Emmy 2009?
SELECT DISTINCT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.award_category = 'Primetime Emmy' AND T1.year = 2009 AND T1.result = 'Winner';
won the award in Primetime Emmy 2009 refers to award_category = 'Primetime Emmy' and year = 2009
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What are the characters that were nominated for Primetime Emmy Award from 2009 to 2010 but did not win?
SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.award_category = 'Primetime Emmy' AND T1.year BETWEEN 2009 AND 2010 AND T1.result != 'Winner';
nominated for Primetime Emmy Award but did not win refers to award_category = 'Primetime Emmy' and result = 'Nominee';  from 2009 to 2010 refers to year > = '2009' and  year < = '2010'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Calculate the total votes of episodes that Adam Kuhlman had involved.
SELECT SUM(T1.votes) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Adam Kuhlman';
Adam Kuhlman had involved refers to person = 'Adam Kuhlman'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down the keyword and crew member's name for episode id S20-E1.
SELECT T1.keyword, T2.person FROM Keyword AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.episode_id = 'S20-E1';
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the keyword for episodes with stars score of 10 at 30% and above?
SELECT T1.keyword FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 AND T2.percent > 29;
stars score of 10 at 30% and above refers to stars = 10 and percent > 29
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the percentage of star score 5 that was collected by title "Sex, Pies and Idiot Scrapes"?
SELECT CAST(SUM(CASE WHEN T2.stars = 5 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Sex, Pies and Idiot Scrapes';
percentage = DIVIDE(SUM(stars = 5), COUNT(stars)) as percentage
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Please check is "limbo dancing" the keyword for title "Dangerous Curves"?
SELECT CASE WHEN T2.Keyword = 'limbo dancing' THEN 'Yes' ELSE 'No' END AS result FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Dangerous Curves';
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Which title is the winner of Best International TV Series in 2017?
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award = 'Best International TV Series' AND SUBSTR(T1.year, 1, 4) = '2017';
winner refers to result = 'Winner'; Best International TV Series in 2017 refers to award = 'Best International TV Series' and year = '2017'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Write down all the keywords for winner of "WGA Award (TV)" award.
SELECT T2.keyword FROM Award AS T1 INNER JOIN Keyword AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'WGA Award (TV)';
winner of "WGA Award (TV)" award refers to award_category = 'WGA Award (TV)' and result = 'Winner'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
State the birth place of co-executive producer for nominee of "Outstanding Animated Program (For Programming Less Than One Hour)" award.
SELECT T1.birth_place FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.role = 'co-executive producer';
co-executive producer refers to role = 'co-executive producer'; nominee of "Outstanding Animated Program (For Programming Less Than One Hour)" award refers to award = 'Outstanding Animated Program (For Programming Less Than One Hour)' and result = 'Nominee'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Sum up the votes from star 1 to 5 for all of the contestants in Blimp Award.
SELECT T2.stars, SUM(T2.stars) FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Blimp Award' AND T2.stars BETWEEN 1 AND 5 GROUP BY T2.stars;
contestants refers to result = 'Winner' and result = 'Nominee'; in Blimp Award refers to award = 'Blimp Award'; star 1 to 5 refers to 1 < stars < 5
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Calculate the total rating of winners in OFTA Television Award and WGA Award (TV).
SELECT SUM(T2.rating) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.award_category IN ('Jupiter Award ', 'WGA Award (TV)');
winners refers to result = 'Winner'; in OFTA Television Award and WGA Award (TV) refers to award = 'OFTA Television Award' and award = 'WGA Award (TV)'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Out of the rating of 6.8 scored by title "No Loan Again, Naturally", how many percent of it consists of scores 5 to 10?
SELECT SUM(T2.percent) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'No Loan Again, Naturally' AND T1.rating = 6.8 AND T2.stars BETWEEN 5 AND 10;
scores 5 to 10 refers to TOTAL(percent) where 1 < = stars < 5
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many episodes have the star score greater than 8?
SELECT COUNT(DISTINCT episode_id) FROM Vote WHERE stars > 8;
star score greater than 8 refers to stars > 8
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Which episode has the highest number of vote of the star score?
SELECT episode_id FROM Vote ORDER BY votes DESC LIMIT 1;
highest number of vote of the star score refers to max(votes)
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many episodes have the keyword "2d animation"?
SELECT COUNT(episode_id) FROM Keyword WHERE keyword = '2d animation';
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Name the organization which hold the award id 328.
SELECT organization FROM Award WHERE award_id = 328;
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many awards had been held in 2009?
SELECT COUNT(award_id) FROM Award WHERE SUBSTR(year, 1, 4) = '2009';
had been held in 2009 refers to year = 2009
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many awards classified as "Primetime Emmy" category?
SELECT COUNT(award_id) FROM Award WHERE award_category = 'Primetime Emmy';
category refers to award_category
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List out the birth name of crews who are co-executive producer and higher than 1.60 meters.
SELECT T1.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'co-executive producer' AND T1.height_meters > 1.60;
co-executive producer refers to role = 'co-executive producer'; higher than 1.60 meters refers to height_meters > 1.60
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Calculate the percentage of the nominees who were born in USA.
SELECT CAST(SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Nominee';
nominees refers to result = 'Nominee'; born in USA refers to birth_country = 'USA'; percentage = divide(sum(result = 'Nominee' and birth_country = 'USA'), count(Person.name)) * 100%
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Calculate the percentage of the winners who are higher than 1.75 meters.
SELECT CAST(SUM(CASE WHEN T1.height_meters > 1.75 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.result = 'Winner';
winners refers to result = 'Winner'; higher than 1.75 meters refers to height_meters > 1.75; percentage = divide(sum(result = 'Winner' and height_meters > 1.75), count(result = 'Winner' )) * 100%
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List out the title of episodes which have star score of 2.
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2;
star score of 2 refers to stars = 2
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List out the star scores of episode which has title of "How the Test Was Won".
SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'How the Test Was Won';
star scores refers to stars
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Among the episodes which have star score greater than 5, how many episodes have air date in 2008?
SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2008' AND T2.stars > 5;
star score greater than 5 refers to stars > 5; have air date in 2008 refers to air_date LIKE '2008%'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List out the names of the awarded character in the awards held in 2009.
SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009;
in 2009 refers to year = 2009; name of awarded character refers to character
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Which are the years that character Mr. Burns won an award?
SELECT DISTINCT T1.year FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.character = 'Mr. Burns';
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the awarded category that the awarded character Lenny won?
SELECT DISTINCT T1.award_category FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.character = 'Lenny';
awarded category refers to award_category
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the name of actor who took the role Smithers?
SELECT DISTINCT T1.person FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T2.character = 'Smithers';
name refers to person; the role Smithers refers to character = 'Smithers'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What are the keywords of the episode which has title as Dangerous Curves?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Dangerous Curves';
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What are the keywords of the episodes which have the air date in 2008?
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008';
have air date in 2008 refers to air_date LIKE '2008%'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Among the episodes which have star score less than 8, how many episodes were aired in 2009?
SELECT COUNT(DISTINCT T2.episode_id) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE strftime('%Y', T1.air_date) = '2009' AND T2.stars < 8;
star score less than 8 refers to stars < 8; aired in 2009 refers to air_date LIKE '2009%'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
State the birth name of crews who are director and have birth country in South Korea.
SELECT T1.birth_name FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.role = 'director' AND T1.birth_country = 'South Korea';
director refers to role = 'director'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
How many awards did simpson 20 won in 2009?
SELECT COUNT(award_id) FROM Award WHERE SUBSTR(year, 1, 4) = '2009' AND result = 'Winner';
won refers to result = 'Winner'; in 2009 refers to year = 2009
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the total number of episode with a rating below 7?
SELECT COUNT(episode_id) FROM Episode WHERE rating < 7;
rating below 7 refers to rating < 7
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down the names of person born in California, USA.
SELECT name FROM Person WHERE birth_region = 'California' AND birth_country = 'USA';
California refers to birth_region = 'California'; USA refers to birth_country = 'USA'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
In between the episode 5 and10 of season 2, how many of them are credited for casting?
SELECT COUNT(credited) FROM Credit WHERE episode_id IN ( 'S20-E5', 'S20-E6', 'S20-E7', 'S20-E8', 'S20-E9', 'S20-E10' ) AND credited = 'true' AND role = 'casting';
between the episode 5 and 10 of season 20 refers to episode_id IN('S20-E5', 'S20-E6', 'S20-E7', 'S20-E8', 'S20-E9', 'S20-E10'); credited refers to credited = 'true'; for casting refers to role = 'casting'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the episode ID that received 2 stars and 9 votes?
SELECT episode_id FROM Vote WHERE stars = 2 AND votes = 9;
2 stars refers to stars = 2; 9 votes refers to votes = 9
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Give the title of the episode won in Primetime Emmy Awards 2009.
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.organization = 'Primetime Emmy Awards' AND T1.year = 2009 AND T1.result = 'Winner';
won refers to result = 'Winner'; in Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; 2009 refers to year = 2009
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List down the episode ID of episodes aired in 2008 with 5 stars and below.
SELECT DISTINCT T1.episode_id FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T2.stars < 5;
aired in 2008 refers to air_date LIKE '2008%'; 5 stars and below refers to stars < 5
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Among the episode with highest votes, what is the category credited to Carlton Batten?
SELECT T2.category FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.person = 'Carlton Batten' AND T2.credited = 'true' ORDER BY T1.votes DESC LIMIT 1;
highest votes refers to max(votes); to Carlton Batten refers to person = 'Carlton Batten'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Among the episodes aired in 2008 with votes ranges from 920 to 950, list their percent.
SELECT T2.percent FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 4) = '2008' AND T1.votes BETWEEN 950 AND 960;
aired in 2008 refers to air_date LIKE '2008%'; votes ranges from 920 to 950 refers to votes BETWEEN 920 AND 950
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List the episode ID and title of episode where casting was credited to Bonita Pietila.
SELECT T1.episode_id, T1.title FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Bonita Pietila' AND T2.role = 'casting';
was credited refers to credited = 'true'; to Bonita Pietila refers to person = 'Bonita Pietila'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
In episode nominated in Annie Awards, how many of the episodes have a percent greater than 6?
SELECT COUNT(*) FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.organization = 'Annie Awards' AND T1.result = 'Nominee' AND T2.percent > 6;
nominated refers to result = 'Nominee'; Annie Awards refers to organization = 'Annie Awards'; percent greater than 6 refers to percent > 6
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the title of episode nominated for WGA Award (TV) with votes greater than 1000?
SELECT DISTINCT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.votes > 1000 AND T1.award_category = 'WGA Award (TV)' AND T1.result = 'Nominee';
nominated refers to result = 'Nominee'; WGA Award (TV) refers to award_category = 'WGA Award (TV)'; votes greater than 1000 refers to votes > 1000
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
Among the people in Animation Department, who are credited for additional time in the episode titled by "How the Test Was Won"?
SELECT T2.person FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'How the Test Was Won' AND T2.role = 'additional timer' AND T2.credited = 'true' AND T2.category = 'Animation Department';
Animation Department refers to category = 'Animation Department'; credited refers to credited = 'true'; for additional timer refers to role = 'additional timer'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List the stars of episodes aired in November 2008.
SELECT T2.stars FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE SUBSTR(T1.air_date, 1, 7) = '2008-11';
in November 2008 refers to air_date LIKE '2008-11%'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
What is the title of episode with 5 stars and nominated for Prism Award which is aired on April 19, 2009?
SELECT T3.title FROM Award AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id INNER JOIN Episode AS T3 ON T1.episode_id = T3.episode_id WHERE T3.air_date = '2009-04-19' AND T1.award_category = 'Prism Award' AND T2.stars = 5 AND T1.result = 'Nominee';
5 stars refers to stars = 5; nominated refers to result = 'Nominee'; Prism Award refers to award_category = 'Prism Award'; on April 19 2009 refers to air_date = '2009-04-19'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
In episode with the highest votes, list the category of awards it is nominated for.
SELECT T1.award_category FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.result = 'Nominee' ORDER BY T2.votes DESC LIMIT 1;
highest votes refers to max(votes); nominated refers to result = 'Nominee'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
In episodes aired in 2009, how many of them are credited to Sam Im for additional timer?
SELECT COUNT(*) FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'true' AND T2.person = 'Sam Im' AND SUBSTR(T1.air_date, 1, 4) = '2009' AND T2.role = 'additional timer';
in 2009 refers to air_date LIKE '2009%'; credited refers to credited = 'true'; Sam Im refers to person = 'Sam Im'; for additional timer refers to role = 'additional timer'
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
List the title of the episode with stars greater than the 70% of average stars of all episodes.
SELECT DISTINCT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars > 0.7 * ( SELECT AVG(stars) FROM Vote );
stars greater than the 70% of average stars refers to stars > multiply(avg(stars), 0.7)
simpson_episodes
CREATE TABLE "Episode" ( episode_id TEXT constraint Episode_pk primary key, season INTEGER, episode INTEGER, number_in_series INTEGER, title TEXT, summary TEXT, air_date TEXT, episode_image TEXT, rating ...
【DB_ID】 simpson_episodes 【Schema】 # Table: main.Award [ (award_id:INTEGER, Primary Key, Examples: [325, 326, 327]), (organization:TEXT, Examples: [Primetime Emmy Awards]), (year:INTEGER, Examples: [2009, 2010, 2017]), (award_category:TEXT, Examples: [Primetime Emmy, Annie, Image Award]), (award:TEXT), (person:TEXT, Exa...
In year 2009, what is the percentage of the episode titled by "Gone Maggie Gone" being nominated?
SELECT CAST((SUM(CASE WHEN T1.result = 'Nominee' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.result = 'Winner' THEN 1 ELSE 0 END)) AS REAL) * 100 / COUNT(T1.result) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T2.title = 'Gone Maggie Gone' AND T1.year = 2009;
being nominated refers to result = 'Nominee'; percentage = divide(count(result = 'Nominee'), count(result)) * 100%
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students have never been absent from school?
SELECT COUNT(name) FROM longest_absense_from_school WHERE `month` = 0
have never been absent refers to `month` = 0;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
For the students who have been absent from school for the longest time, how many months have they been absent?
SELECT MAX(month) FROM longest_absense_from_school
absent from school for the longest time refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students belong to the navy department?
SELECT COUNT(name) FROM enlist WHERE organ = 'navy'
belong to the navy department refers to organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students that have been absent from school for more than 5 months, how many of them are male?
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` >= 5
absent from school for more than 5 months refers to `month`  > = 5;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Please list the names of the male students that belong to the navy department.
SELECT T1.name FROM enlist AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'navy'
belong to the navy department refers to organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students that have filed for bankruptcy, how many of them have been absent from school for over 5 months?
SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.`name` = T2.`name` WHERE T2.`month` > 5
absent from school for over 5 months refers to `month` > 5;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students from the navy department, how many of them have payment due?
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN no_payment_due AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'navy' AND T2.bool = 'pos'
from the navy department refers to organ = 'navy'; have payment due refers to bool = 'pos';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Please list the male students that are disabled and have filed for bankruptcy.
SELECT T1.name, T2.name, T3.name FROM disabled AS T1 INNER JOIN male AS T2 ON T1.`name` = T2.`name` INNER JOIN filed_for_bankrupcy AS T3 ON T1.`name` = T3.`name`
male students that are disabled and have filed for bankruptcy refers to name that appeared in all three male, disabled and filed_for_bankrupcy tables.
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many female students are disabled?
SELECT COUNT(name) FROM disabled WHERE name NOT IN ( SELECT name FROM male )
females students are disabled refers to name that appeared in both disabled and male tables
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are unemployed and have payment due?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.`name` = T2.`name`
are unemployed and have payment due refers to
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the longest time for a student from the navy department to be absent from school?
SELECT T1.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy' ORDER BY T1.`month` DESC LIMIT 1
navy department refers to organ = 'navy'; longest time to be absent from school refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many disabled students have never been absent from school?
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 0
never been absent from school refers to month = 0
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Please list the departments the students are absent from school for 9 months are in.
SELECT T2.organ FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.`month` = 9
absent from school for 9 months refers to month = 9
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which department has the most disabled students?
SELECT T2.organ, COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` GROUP BY T2.organ ORDER BY COUNT(T1.name) DESC LIMIT 1
department refers to organ; most disabled students refers to MAX(disabled.name)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Please list all the female students that have filed for bankruptcy.
SELECT name FROM filed_for_bankrupcy WHERE name NOT IN ( SELECT name FROM male )
females students have filed for bankruptcy refers to name that appeared in both filed_for_bankrupcy and male tables
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the percentage of male students in the navy department?
SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'navy'
in the navy department refers to organ = 'navy'; percentage refers to DIVIDE(COUNT(name where organ = 'navy'), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the average time for a disabled student to be absent from school?
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name`
average time refers to DIVIDE(SUM(`month`), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Name all students enlisted in the foreign legion.
SELECT name FROM enlist WHERE organ = 'foreign_legion'
in the foreign legion organ = 'foreign_legion';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Does student348 have a due payment?
SELECT bool FROM no_payment_due WHERE name = 'student348'
payment due refers to bool = 'pos' means the student has payment due , bool = 'neg' means the student does not have payment due;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which school is student829 enrolled in?
SELECT school FROM enrolled WHERE name = 'student829'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many months has student217 been absent?
SELECT month FROM longest_absense_from_school WHERE name = 'student217'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List all students that have been absent for 6 months.
SELECT name FROM longest_absense_from_school WHERE `month` = 6
absent for 6 months `month` = 6;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which organization did student285 enlist?
SELECT organ FROM enlist WHERE name = 'student285'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Is student281 disabled and which school is the student enrolled in?
SELECT T2.name, T1.school FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.name = 'student281'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List all students in the air force and which school they were enrolled at.
SELECT T1.name, T1.school FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'air_force'
in the air force refers to organ = 'air_force';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List 10 students that have no due payments and are not males.
SELECT T1.name FROM no_payment_due AS T1 INNER JOIN person AS T2 ON T1.`name` = T2.`name` WHERE T2.`name` NOT IN ( SELECT name FROM male ) AND T1.bool = 'neg'
no due payments refers to bool = 'neg'; not males refers to not in male table
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Name 5 students with due payments that are enlisted alongside which organization they were enlisted.
SELECT T2.organ, T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.bool = 'pos' LIMIT 5
with due payments refers to bool = 'pos'; organization refers to organ
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Name all disabled students that are enrolled in SMC.
SELECT T2.name FROM enrolled AS T1 INNER JOIN disabled AS T2 ON T1.`name` = T2.`name` WHERE T1.school = 'smc'
enrolled in SMC refers to school = 'smc';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which students that filed for bankruptcy are also in the foreign legion?
SELECT T2.name FROM enlist AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.`name` = T2.`name` WHERE T1.organ = 'foreign_legion'
in the foreign legion refers to organ = 'foreign_legion';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many male students have no due payments?
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.bool = 'neg'
have no due payments refers to bool = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which students that are in the marines have been absent for 6 months?
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'marines' AND T1.`month` = 6
in the marines refers to organ = 'marines'; absent for 6 months refers to month = 6
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students from SMC are unemployed?
SELECT T2.name FROM enrolled AS T1 INNER JOIN unemployed AS T2 ON T1.`name` = T2.`name` WHERE T1.school = 'smc'
from SMC refers to school = 'smc';