db_id
stringclasses
66 values
question
stringlengths
24
325
evidence
stringlengths
1
673
gold_query
stringlengths
23
804
db_schema
stringclasses
66 values
simpson_episodes
Among episodes from 10 to 20, which episode has more than 200 votes?
episodes from 10 to 20 refers to episode BETWEEN 10 and 20; more than 200 votes refers to COUNT(votes) > 200
SELECT DISTINCT T1.episode FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.episode BETWEEN 10 AND 20 AND T2.votes > 200;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
What is the institution's name of american students within the number of degree-seeking students in the cohort that ranges from 1 to 3?
institution's name refers to chronname; american refers to race = 'Ai'; number of degree-seeking students in the cohort refers to grad_cohort; grad_cohort < = 3;
SELECT DISTINCT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.grad_cohort BETWEEN 1 AND 3 AND T2.race = 'Ai'
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
Current legislator Roger F. Wicker has not been a representative for how many terms?
Roger F. Wicker is an official_full_name; not a representative refers to district IS NULL OR district = ''
SELECT SUM(CASE WHEN T1.official_full_name = 'Roger F. Wicker' THEN 1 ELSE 0 END) AS count FROM current AS T1 INNER JOIN `current-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T2.district IS NULL OR T2.district = ''
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Name of the crew that were born in California, USA between 1958 and 1969.
born in California refers to birth_place = 'California'; USA refers to birth_country = 'USA'; between 1958 and 1969 refers to birthdate BETWEEN '1958-01-01' and '1958-12-31'
SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1958' AND birth_place = 'California' AND birth_country = 'USA';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
Please list the official full names of all the current legislators who were once a senator during his or her terms.
once a senator during term refers to state_rank IS NOT NULL
SELECT T2.official_full_name FROM `current-terms` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.state_rank IS NOT NULL
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Which episode id did award Outstanding Animated Program (For Programming Less Than One Hour) with an episode star score of 10?
star score of 10 refers to stars = 10
SELECT DISTINCT T1.episode_id FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.stars = 10;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
What is the state name of male graduate in 2011 from a private for profit institution with black students?
male refers to gender = 'M'; in 2011 refers to year = '2011'; private for profit refers to control = 'Private for-profit'; black refers to race = 'B';
SELECT DISTINCT T1.state FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.gender = 'M' AND T2.race = 'B' AND T1.control = 'Private for-profit' AND T2.year = 2011
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Please indicate the keywords of the title "Double, Double, Boy in Trouble".
null
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Double, Double, Boy in Trouble';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
simpson_episodes
Who is the recipient of the Primetime Emmy Award with the most votes?
Primetime Emmy Award refers to award_category = 'Primetime Emmy'; the most votes refers to MAX(votes)
SELECT T1.person FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Primetime Emmy' ORDER BY T2.votes DESC LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
What is the total male graduates in 2012 in the state whereby the institute with the highest average amount of student aid going to undergraduate recipients is located?
male refers to gender = 'M'; graduates refers to grad_cohort; in 2012 refers to year = 2012; highest average amount of student aid going to undergraduate recipients refers to MAX(aid_value);
SELECT COUNT(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T1.state = T2.state WHERE T2.year = 2012 AND T2.gender = 'M' ORDER BY T1.aid_value DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
Please list the current official YouTube usernames of all the current female legislators.
official YouTube usernames refers to youtube; female refers to gender_bio = 'F'
SELECT T2.youtube FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T1.gender_bio = 'F'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
legislator
Among the current legislators who do not have accounts on OpenSecrets.org., how many of them do not have instagram accounts either?
do not have accounts on OpenSecrets.org refers to opensecrets_ID is NULL OR opensecrets_id = ''; do not have instagram accounts refers to instagram is null
SELECT SUM(CASE WHEN T1.instagram IS NULL THEN 1 ELSE 0 END) AS count FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T2.opensecrets_id IS NULL OR T2.opensecrets_id = ''
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
What is the title of the episode that received the lowest rating?
lowest rating refers to Min(rating)
SELECT title FROM Episode ORDER BY rating LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
List the race of institutions in Alabama with number of students greater than the 90% of average number of students of all institutions?
Alabama refers to state = 'Alabama'; number of students greater than the 90% of average = MULTIPLY(AVG(student_count), 90%) < student_count;
SELECT DISTINCT T2.race FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.student_count > ( SELECT AVG(T1.student_count) * 0.9 FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.state = 'Alabama' ) AND T1.state = 'Alabama...
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
college_completion
List the site of institution within the student count of 500 to 1000 that has the recent year of data release.
recent year of data release refers to newest year;
SELECT DISTINCT T1.site FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.student_count BETWEEN 500 AND 1000 AND T2.year = ( SELECT MAX(T2.year) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid )
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
How old was the awardee when he/she won the first-ever award for Outstanding Voice-Over Performance in Primetime Emmy Awards?
"Outstanding Voice-Over Performance" is the award; 'Primetime Emmy Awards' is the organization; awardee refers to result = 'Winner'; first ever award refers to Min(year); age at the time of awarded refers to Subtract(year, SUBSTR(birthdate, 0, 5))
SELECT T2.year - CAST(SUBSTR(T1.birthdate, 1, 4) AS int) AS age FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award = 'Outstanding Voice-Over Performance' AND T2.organization = 'Primetime Emmy Awards' AND T2.result = 'Winner';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
What is the username of the current official Facebook presence of the oldest current legislator?
username of the official Facebook refers to facebook; the oldest refers to MAX(birthday_bio)
SELECT T2.facebook FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id ORDER BY T1.birthday_bio LIMIT 1
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Please indicate which writer has an episode star score greater than 5 in 2009.
writer refers to role = 'writer'; star score greater than 5 refers to stars > 5; in 2009 refers to year = 2009
SELECT T1.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2009' AND T1.role = 'writer' AND T2.votes > 5;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
In female students in year 2012, how many of them from a state with number of schools ranges from 10 to 20?
female refers to gender = 'F'; number of schools refers to schools_count; schools_count BETWEEN 10 AND 20;
SELECT COUNT(T2.race) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.gender = 'F' AND schools_count BETWEEN 10 AND 20 AND T2.year = 2012
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Please indicate the keywords of the episode that won the Primetime Emmy Award category.
Primetime Emmy Award refers to award_category = 'Primetime Emmy'
SELECT T2.keyword FROM Award AS T1 INNER JOIN Keyword AS T2 ON T2.episode_id = T1.episode_id WHERE T1.award_category = 'Primetime Emmy';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
In the state of Connecticut, what is the name of the instution with the highest percent rank for freshman retention percentage within the sector?
name of the institution refers to chronname;  highest percent rank for freshman retention percentage within the sector refers to MAX(retain_percentile);
SELECT chronname FROM institution_details WHERE state = 'Connecticut' AND retain_percentile = ( SELECT MAX(retain_percentile) FROM institution_details WHERE state = 'Connecticut' )
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Which episode did the composer win for Outstanding Music Composition for a Series (Original Dramatic Score) with more than 200 votes?
more than 200 votes refer to votes > 200; composer refers to role = 'composer'; Outstanding Music Composition for a Series (Original Dramatic Score) refers to award = 'Outstanding Music Composition for a Series (Original Dramatic Score)'
SELECT DISTINCT T1.episode_id FROM Award AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.role = 'composer' AND T1.award = 'Outstanding Music Composition for a Series (Original Dramatic Score)' AND T2.votes > 200;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
How many current legislators do not have an account on instagram?
do not have an account on instagram refers to instagram is null
SELECT COUNT(*) FROM `social-media` AS T1 INNER JOIN current AS T2 ON T1.bioguide = T2.bioguide_id WHERE T1.instagram IS NULL
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Please give the name of the director who achieved the Outstanding Animated Program (For Programming Less Than One Hour) award whose episode title is "No Loan Again, Naturally".
the director refers to role = 'director'
SELECT T1.person FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE T1.role = 'director' AND T1.award = 'Outstanding Animated Program (For Programming Less Than One Hour)' AND T2.title = 'No Loan Again, Naturally';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
Among the black students in 2011, list the institution site and name of those who has 20 t0 30 degree-seeking students in the cohort.
black refers to race = 'B'; in 2011 refers to year = '2011'; institution name refers to chronname; 20 to 30 degree-seeking students in the cohort refers to grad_cohort BWEEN 20 AND 30;
SELECT DISTINCT T1.site, T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.year = 2011 AND T2.race = 'B' AND T2.grad_cohort BETWEEN 20 AND 30
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
What award did the character Homer simpson 20 achieve in 2009?
in 2009 refers to year = 2009
SELECT DISTINCT T1.award FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009 AND T2.character = 'Homer Simpson';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
Among legislators who have an Instagram account, list down their full names and nicknames who have a Thomas ID of less than 1000.
have an Instagram account refers to instagram is not null; full names refers to official_full_name; nicknames refers to nickname_name; Thomas ID of less than 1000 refers to thomas_id < 1000;
SELECT T1.official_full_name, T1.nickname_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.instagram IS NOT NULL AND T1.thomas_id < 1000
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
How many WGA Award (TV) award recipients were born in the USA from 2009 to 2010?
WGA Award (TV) award refers to award_category = 'WGA Award (TV)'; born in the USA refers to birth_country = 'USA'; from 2009 to 2010 refers to birthdate BETWEEN '2019-01-01' and '2019-12-31'
SELECT COUNT(*) FROM Person AS T1 INNER JOIN Award AS T2 ON T1.name = T2.person WHERE T2.award_category = 'WGA Award (TV)' AND T1.birth_country = 'USA' AND T2.year BETWEEN 2009 AND 2010;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
In year 2010 at schools located in Hawaii, what is the percentage of schools offers an associate's degree?
Hawaii refers to state = 'Hawaii'; associate's degree refers to level = '2-year'; percentage = MULTIPLY(DIVIDE(SUM(level = '2-year' ), count(level)), 1.0);
SELECT CAST(SUM(CASE WHEN T2.level = '2-year' THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(T2.level) FROM state_sector_details AS T1 INNER JOIN state_sector_grads AS T2 ON T2.stateid = T1.stateid WHERE T2.state = 'Hawaii' AND T2.year = 2010
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
Which current legislator is older, Sherrod Brown or Maria Cantwell?
older refers to MAX(birthday_bio); 'Sherrod Brown' and 'Maria Cantwell' are official_full_name
SELECT official_full_name FROM current WHERE official_full_name = 'Sherrod Brown' OR official_full_name = 'Maria Cantwell' ORDER BY birthday_bio LIMIT 1
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
How much more votes for episode 1 than for episode 5?
more votes refers to SUBTRACT(SUM(votes when episode = 1), SUM(votes when episode = 5))
SELECT SUM(CASE WHEN T1.episode = 1 THEN T2.votes ELSE 0 END) - SUM(CASE WHEN T1.episode = 5 THEN T2.votes ELSE 0 END) AS diff FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
To which current legislator does twitter ID234128524 belong? Please give his or her full official name.
full official name refers to official_full_name
SELECT T1.official_full_name FROM current AS T1 INNER JOIN `social-media` AS T2 ON T2.bioguide = T1.bioguide_id WHERE T2.twitter_id = 234128524
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
college_completion
In Harvard University, which year recorded the highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions?
Harvard University refers to chronname = 'Harvard University'; highest number of first-time, full-time, degree-seeking students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort);
SELECT T2.year FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Harvard University' GROUP BY T2.year ORDER BY SUM(T2.grad_cohort) DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Among the episodes aired on April of 2009, how many episodes won an award?
aired on refers to air_date, April refers to SUBSTR(air_date, 6, 2) = '04'; 2009 refers to SUBSTR (air_date, 0, 5) = '2009'
SELECT COUNT(T1.episode_id) FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2009' AND T2.air_date LIKE '2009-04%';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
authors
Sate the author name and published year for paper id 2?
published year refers to year
SELECT T1.Name, T3.Year FROM Author AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.AuthorId INNER JOIN Paper AS T3 ON T2.PaperId = T3.Id WHERE T2.PaperId = 2
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
simpson_episodes
How many recipients of the Primetime Emmy Award category that were born in the USA? Find the percentage of Americans in the total number of the country.
born in the USA refers to birth_country = 'USA'; recipients refers to person = 'recipients'; percentage refers to DIVIDE(COUNT(birth_country = 'USA'), count(award_id))
SELECT SUM(CASE WHEN T1.birth_country = 'USA' THEN 1 ELSE 0 END) AS num , 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.award_category = 'Primetime Emmy' AND T2.person = 'Dan Castellaneta';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
In Yale University, what is the average number of Black students per year who were bachelor's/equivalent-seeking cohort at 4-year institutions between 2002 to 2005?
Yale University refers to chronname = 'Yale University'; average = DIVIDE(COUNT(race = 'B' WHERE cohort = '4y bach AND year BETWEEN 2002 AND 2005), 3); Black refers to race = 'B'; bachelor's/equivalent-seeking cohort at 4-year institutions refers to cohort = '4y bach'; between 2002 to 2005 refers to year BETWEEN '2002'...
SELECT AVG(T2.grad_cohort) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'Yale University' AND T2.year BETWEEN 2002 AND 2005 AND T2.race = 'B' AND T2.cohort = '4y bach'
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
disney
What are the characters in the PG movies?
PG is an abbreviation for parental guidance and refers to MPAA_rating = 'PG';
SELECT DISTINCT T2.character FROM movies_total_gross AS T1 INNER JOIN `voice-actors` AS T2 ON T1.movie_title = T2.movie WHERE T1.MPAA_rating = 'PG'
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
legislator
What is the username of the current official Facebook presence of current legislator Todd Young?
Todd Young is an official_full_name; username of current official Facebook presences refers to facebook;
SELECT T1.facebook FROM `social-media` AS T1 INNER JOIN current AS T2 ON T2.bioguide_id = T1.bioguide WHERE T2.official_full_name = 'Todd Young'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
The person named Al Jean achieved the Primetime Emmy Award category in 2009, which episode did AI Jean achieve?
in 2009 refers to year = 2009
SELECT T2.episode_id FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2009' AND T1.person = 'Al Jean' AND T1.award_category = 'Primetime Emmy';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
List the IDs and full names of legislators from the Liberal Republican party.
full_name refers to first_name, last_name; from the Liberal Republican party refers to party = 'Liberal Republican'
SELECT T2.bioguide_id, T2.first_name, T2.last_name FROM `historical-terms` AS T1 INNER JOIN historical AS T2 ON T2.bioguide_id = T1.bioguide WHERE T1.party = 'Liberal Republican'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
In the crew, who was born in 1962 in California?
born in 1962 refers to year(birthdate) = 1962; in California refers to birth_region = 'California'
SELECT name FROM Person WHERE SUBSTR(birthdate, 1, 4) = '1962' AND birth_region = 'California';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
Among all the current female legislators, how many of them have not been registered in Federal Election Commission data?
have not been registered refers to fec_id IS NULL; female refers to gender_bio = 'F'
SELECT COUNT(*) FROM current WHERE (fec_id IS NULL OR fec_id = '') AND gender_bio = 'F'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
college_completion
What is the website address of the institution with the highest number of White degree-seeking students at 2-year institutions in 2008?
website address refers to site; White refers to race = 'W'; degree-seeking students at 2-year institutions refers to cohort = '2y all'; in 2008 refers to year = '2008';
SELECT T1.site FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.race = 'W' AND T2.cohort = '2y all' AND T2.year = 2008 ORDER BY T2.grad_cohort DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
How many episodes have won the award for Outstanding Animated Program (Programming Under One Hour) with less than 100 votes? Calculate the percentage of episodes with less than 100 votes out of total episodes.
less than 100 votes refers to votes < 100; percentage refers to DIVIDE(COUNT(episode_id when votes < 100), COUNT(episode_id)) * 100%
SELECT SUM(CASE WHEN T2.votes < 100 THEN 1 ELSE 0 END) AS num , CAST(SUM(CASE WHEN T2.votes < 100 THEN 1 ELSE 0 END) AS REAL) * 100 / COUNT(*) 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 T1.award = 'Outstanding Animated Program ...
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
How many 4-year public institutions are there in the state of Florida? Give all of their names.
4-year refers to level = '4-year'; public refers to control = 'Public'; names refers to chronname;
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 WHERE T2.level = '4-year' AND T2.control = 'Public' AND T2.state = 'Florida'
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
college_completion
In the state with the highest state appropriations to higher education in fiscal year 2011 per resident, which institution has the lowest number of undergraduates in 2010?
highest state appropriations to higher education in fiscal year 2011 per resident refers to MAX(state_appr_value); lowest number of undergraduates refers to MIN(student_count); in 2010 refers to year = 2010;
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state INNER JOIN institution_grads AS T3 ON T3.unitid = T1.unitid WHERE T1.student_count = ( SELECT MIN(T1.student_count) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state ...
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
What is the google entity ID of current legislator Sherrod Brown?
Sherrod Brown is an official_full_name
SELECT google_entity_id_id FROM current WHERE official_full_name = 'Sherrod Brown'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
How many executive producers are the nominees for the award of "Outstanding Animated Program (For Programming Less Than One Hour)"?
the nominees refers to result = 'Nominee'; executive producers refers to role = 'executive producer'
SELECT COUNT(*) FROM Award WHERE role = 'executive producer' AND result = 'Nominee' AND award = 'Outstanding Animated Program (For Programming Less Than One Hour)';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
simpson_episodes
How many episodes was Dell Hake not included in the credit list?
"Dell Hake" is the person; not included in the credit list refers to credited = ''
SELECT COUNT(*) FROM Credit WHERE person = 'Dell Hake' AND credited = 'false';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
Among the Ivy League Schools, which school have the highest number of Hispanic graduates of all time?
Ivy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; ...
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) AND...
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
How many people were considered as prospective recipients of the "Animation" award?
prospective recipients refers to result = 'Nominee'
SELECT COUNT(*) FROM Award WHERE award = 'Animation' AND result = 'Nominee';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
legislator
Please list the official full names of all the current legislators who do not have an account on C-SPAN's video website.
legislators who do not have an account refers to cspan_id IS NULL OR cspan_id = ''
SELECT official_full_name FROM current WHERE cspan_id IS NULL OR cspan_id = ''
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
college_completion
In the state with the highest number of schools, how many institutions have a percentage of no less than 90 of undergraduates who attend full-time? List all of the institutions' names.
highest number of schools refers to MAX(schools_count); percentage of no less than 90 of undergraduates who attend full-time refers to ft_pct > 90; institutions' names refers to chronname;
SELECT COUNT(t1.unitid), t1.chronname FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON t1.state = t2.state WHERE t1.ft_pct > 90 ORDER BY t2.schools_count DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
cars
What is the average weight of Japanese cars with 4 cylinders that were produced from 1975 to 1980?
Japanese car refers to country = 'Japan'; with 4 cylinders refers to cylinders = 4; produced from 1975 to 1980 refers to model_year BETWEEN 1975 AND 1980; average weight = avg(weight)
SELECT AVG(T1.weight) FROM data AS T1 INNER JOIN production AS T2 ON T1.ID = T2.ID INNER JOIN country AS T3 ON T3.origin = T2.country WHERE T2.model_year BETWEEN 1975 AND 1980 AND T1.cylinders = 4 AND T3.country = 'Japan'
CREATE TABLE data ( foreign key (ID) references price(ID), acceleration REAL, -- model INTEGER, -- Example Values: `70`, `71`, `72`, `73`, `74` | Value Statics: Total count 398 - Distinct count 13 - Null count 0 horsepower INTEGER, -- weight INTEGER, -- displacement REAL, -- ID INTEGER primary key, c...
legislator
What is the birthday of Amy Klobuchar?
birthday refers to birthday_bio; Amy Klobuchar refers to full name; full name refers to first_name, last_name
SELECT birthday_bio FROM current WHERE first_name = 'Amy' AND last_name = 'Klobuchar'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Please list two people who are the nominees for the "Outstanding Voice-Over Performance" award for season 20.
season 20 refers to episode_id LIKE 'S20%'
SELECT person FROM Award WHERE result = 'Nominee' AND award = 'Outstanding Voice-Over Performance' AND episode_id LIKE 'S20%' LIMIT 2;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
List the all the institutes from the state with the most number of American Indian in 2007.
institutes refers to chronname; American Indian refers to race = 'Ai'; most number of American Indian refers to MAX(COUNT(race = 'Ai')); in 2007 refers to year = '2007';
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN state_sector_grads AS T2 ON T1.state = T2.state WHERE T2.year = 2007 AND T2.race = 'Ai' GROUP BY T1.chronname ORDER BY COUNT(T1.chronname) DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Please list the three episodes with the highest number of votes for the worst star rating.
highest number of votes refers to MAX(COUNT(votes)); worst star rating refers to stars = 1
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = ( SELECT MIN(stars) FROM Vote ) ORDER BY T2.votes DESC LIMIT 3;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
What is the name of the school with the highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions who were seeking another type of degree or certificate at a 4-year institution?
name of the school refers to chronname; highest number of first-time, full-time, degree-seeking female students in the cohort being tracked, minus any exclusions refers to MAX(grad_cohort WHERE gender = 'F'); seeking another type of degree or certificate at a 4-year institution refers to cohort = '4y other';
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T2.gender = 'F' AND T2.cohort = '4y other' ORDER BY T2.grad_cohort DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
How many current legislators do not have an account on ballotpedia.org ?
do not have an account on ballotpedia.org refers to ballotpedia_id IS NULL OR ballotpedia_id = ''
SELECT COUNT(*) FROM current WHERE ballotpedia_id = '' OR ballotpedia_id IS NULL
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
How many of the crew members who are taller than 1.70m were born in Canada?
taller than 1.70m refers to height_meters > 1.70; born in Canada refers to birth_country = 'Canada'
SELECT COUNT(name) FROM Person WHERE height_meters > 1.70 AND birth_country = 'Canada';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
Between the Ivy League Schools, which school's state have the lowest sate appropriations to higher education in fiscal year 2011 per resident?
Ivy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; ...
SELECT T1.state FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) GROUP ...
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
legislator
How many current legislators were born after the year 1960?
born after the year 1960 refers to birthday_bio > '1960-01-01'
SELECT COUNT(bioguide_id) FROM current WHERE birthday_bio >= '1961-01-01'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
What are the top five most popular episodes?
most popular episodes refers to MAX(votes)
SELECT episode_id FROM Episode ORDER BY votes DESC LIMIT 5;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
Between 2011 to 2013, what is the average number of male Hispanic degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time in United Education Institute-Huntington Park Campus?
between 2011 to 2013 refers to year BETWEEN '2011' AND '2013'; male refers to gender = 'M'; Hispanic refers to race = 'H'; number of degree-seeking students at 2-year institutions who graduated within 150 percent of normal/expected time refers to grad_150; United Education Institute-Huntington Park Campus refers to chr...
SELECT AVG(T2.grad_150) FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname = 'United Education Institute-Huntington Park Campus' AND T2.year BETWEEN 2011 AND 2013 AND T2.gender = 'M' AND T2.race = 'H'
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
disney
Name actors who voiced more than five Disney characters.
Actors who voiced refer to voice-actor;
SELECT 'voice-actor' FROM `voice-actors` GROUP BY 'voice-actor' HAVING COUNT(movie) > 5
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
simpson_episodes
What is the name of the person that has the highest number of nominated award but didn't win?
nominated refers to result = 'Nominee'; highest number of nominated award refers to Max(Count(person))
SELECT person FROM Award WHERE result = 'Nominee' GROUP BY person ORDER BY COUNT(person) DESC LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
What is the average SAT value for incoming students in all of the schools located in the state with the lowest state appropriations to higher education in fiscal year 2011 per resident?
average = DIVIDE(SUM(med_sat_value), SUM(chronname)); SAT value for incoming students refers to med_sat_value; lowest state appropriations to higher education in fiscal year 2011 per resident refers to MIN(state_appr_value);
SELECT AVG(t1.med_sat_value) FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON t1.state = t2.state ORDER BY t2.state_appr_value LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
disney
Among all Disney movies directed by Gary Trousdale, determine the percentage that earned over USD100m based on actual grossing.
DIVIDE(COUNT(movie_title where director = 'Gary Trousdale' and total_gross > 100000000), COUNT(movie_title where director = 'Gary Trousdale')) as percentage;
SELECT CAST(COUNT(CASE WHEN CAST(REPLACE(trim(T1.total_gross, '$'), ',', '') AS REAL) > 100000000 THEN T1.movie_title ELSE NULL END) AS REAL) * 100 / COUNT(T1.movie_title) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Gary Trousdale'
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
simpson_episodes
What year did the Simpsons receive its first ever award for Favorite Animated Comedy in People's Choice Award?
"Favorite Animated Comedy" is the award; 'People's Choice Award' is the award_category; received award refers to result = 'Winner'; first ever award refers to Min(year)
SELECT year FROM Award WHERE result = 'Winner' AND award = 'Favorite Animated Comedy' ORDER BY year DESC LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
college_completion
Among the Ivy League Schools in 2013, which schools have the highest number of Black students who graduated within 150 percent of normal/expected time who were seeking a bachelor's/equivalent cohort at 4-year institutions?
Ivy League Schools refers to chronname = 'Brown University' or chronname = 'Columbia University' or chronname = 'Cornell University' or chronname = 'Dartmouth College' or chronname = 'Harvard University' or chronname = 'Princeton University' or chronname = 'University of Pennsylvania' or chronname = 'Yale University'; ...
SELECT T1.chronname FROM institution_details AS T1 INNER JOIN institution_grads AS T2 ON T2.unitid = T1.unitid WHERE T1.chronname IN ( 'Brown University', 'Columbia University', 'Cornell University', 'Dartmouth College', 'Harvard University', 'Princeton University', 'University of Pennsylvania', 'Yale University' ) AND...
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
Please list all of the episodes that aired in 2008 that have the highest number of votes for the maximum star rating.
aired in 2008 refers to air_date like '2008%'; highest number of votes refers to MAX(votes); maximum star rating refers to stars = 10
SELECT 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' ORDER BY T2.votes DESC LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
How many Yelp businesses are there in 'AZ' with less than "3" stars?
AZ refers to state = 'AZ'; stars < 3;
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND stars < 3
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
disney
Name the top 5 highest-grossing Disney movies adjusted for inflation. Identify the percentage they contributed to the total of Disney's current gross.
The top 5 highest-grossing movies adjusted for inflation refer to MAX(inflation_adjusted_gross)LIMIT 5; DIVIDE(SUM(MAX(inflation_adjusted_gross LIMIT 5)), SUM(inflation_adjusted_gross)) as percentage;
SELECT SUM(CASE WHEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) > 1236035515 THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) * 100 / SUM(CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL)) FROM movies_total_gross
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
authors
How many papers were written by authors who cooperated with University of Hong Kong?
University of Hong Kong' is an affiliation
SELECT COUNT(T2.PaperId) FROM Author AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.AuthorId WHERE T1.Affiliation = 'University of Hong Kong'
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
legislator
Give the full name of legislators who have accounts on OpenSecrets.org.
full name refers to first_name, last_name; have accounts on OpenSecrets.org refers to opensecrets_id IS NOT NULL AND opensecrets_id <> ''
SELECT COUNT(*) FROM current WHERE opensecrets_id IS NOT NULL AND opensecrets_id <> ''
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
Please list any three episodes that have an excellent rating.
an excellent rating refers to 7 < rating < = 10
SELECT title FROM Episode WHERE rating BETWEEN 7 AND 10 LIMIT 3;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
disney
What is the difference in the current gross of Cars and its sequel, Cars 2? Which movie is more popular?
SUBTRACT(inflation_adjusted_gross where movie_title = 'Cars', inflation_adjusted_gross where movie_title = 'Cars 2'); more popular movie refers to movie_title where MAX(inflation_adjusted_gross);
SELECT SUM(CASE WHEN movie_title = 'Cars' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END), SUM(CASE WHEN movie_title = 'Cars 2' THEN CAST(REPLACE(trim(inflation_adjusted_gross, '$'), ',', '') AS REAL) ELSE 0 END) FROM movies_total_gross
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
simpson_episodes
Please provide any two episodes' names that have the same keyword of "1930s to 2020s".
null
SELECT T1.title FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T2.keyword = '1930s to 2020s' LIMIT 2;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
How many users have "uber" number of fans?
uber number of fans refers to user_fans = 'uber';
SELECT COUNT(user_id) FROM Users WHERE user_fans LIKE 'Uber'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
college_completion
What is the name of the school with the highest difference in the average completion rate for the national in which it belongs? Indicate the state appropriations to higher education in fiscal year 2011 per resident to which the school belongs.
name of the school refers to chronname; highest difference in the average completion rate for the national in which it belongs = MAX(SUBTRACT(awards_per_value, awards_per_natl_value)); state appropriations to higher education in fiscal year 2011 per resident to which the school belongs refers to state_appr_value;
SELECT T1.chronname, T2.state_appr_value FROM institution_details AS T1 INNER JOIN state_sector_details AS T2 ON T2.state = T1.state ORDER BY T1.awards_per_value - T2.awards_per_natl_value DESC LIMIT 1
CREATE TABLE institution_details ( vsa_enroll_after6_transfer TEXT, -- chronname TEXT, -- vsa_enroll_elsewhere_after6_first TEXT, -- lat_y REAL, -- retain_percentile INTEGER, -- exp_award_state_value INTEGER, -- basic TEXT, -- grad_100_value REAL, -- vsa_grad_after6_transfer TEXT, -- endow_p...
simpson_episodes
What was the character that Dan Castellaneta did the voice over for and was awarded?
voice over for and was awarded refers to award like '%Voice-Over%';
SELECT DISTINCT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.award LIKE '%Voice-Over%' AND T1.person = 'Dan Castellaneta';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
How many long reviews does user No. 36139 give for the Yelp businesses?
long reviews refers to review_length = 'long'; user No. refers to user_id;
SELECT COUNT(review_length) FROM Reviews WHERE user_id = 36139 AND review_length LIKE 'long'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
public_review_platform
What kind of "wi-fi" does Yelp business No."10172" have?
kind of wi-fi refers to attribute_value where attribute_name = 'Wi-Fi'; business No. refers to business_id;
SELECT T2.attribute_value FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T2.business_id = 10172 AND T1.attribute_name LIKE 'wi-fi'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
disney
Name the most recent movie directed by Chris Buck. Which of his movies was more successful in terms of grossing? Use the current gross for comparison.
Chris Buck refers to director = 'Chris Buck'; the most recent movie refers to movie_title where MAX(release_date); current gross refers to inflation_adjusted_gross; more successful movie refers to MAX(inflation_adjusted_gross);
SELECT T1.movie_title, MAX(T1.release_date), MAX(T1.inflation_adjusted_gross) FROM movies_total_gross AS T1 INNER JOIN director AS T2 ON T1.movie_title = T2.name WHERE T2.director = 'Chris Buck'
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
simpson_episodes
What is the number of votes for 10-star for the episode that has the keyword "reference to the fantastic four"?
10-star refers to stars = 10
SELECT T2.votes FROM Keyword AS T1 INNER JOIN Vote AS T2 ON T1.episode_id = T2.episode_id WHERE T2.stars = 10 AND T1.keyword = 'reference to the fantastic four';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
What is the quantity of the closed or not running Yelp Businesses in 'AZ'?
closed or not running refers to active = 'False'; AZ refers to state = 'AZ';
SELECT COUNT(business_id) FROM Business WHERE state LIKE 'AZ' AND active LIKE 'False'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
legislator
Compare the number of legislators who started the term in 1875 and 2005.
started the term in 1875 refers to start LIKE '1875%'; started the term in 2005 refers to start LIKE '2005%'
SELECT SUM(CASE WHEN `current-terms`.start LIKE '2005%' THEN 1 ELSE 0 END) - ( SELECT SUM(CASE WHEN start LIKE '1875%' THEN 1 ELSE 0 END) FROM `historical-terms` ) FROM `current-terms`
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
legislator
Provide the start date, end date, and party of Pearl Peden Oldfield.
start date refers to start; end date refers to end date; Pearl Peden Oldfield refers to official_full_name; official_full_name refers to first_name, middle_name, last_name
SELECT T2.start, T2.`end`, T2.party FROM historical AS T1 INNER JOIN `historical-terms` AS T2 ON T1.bioguide_id = T2.bioguide WHERE T1.first_name = 'Pearl' AND T1.middle_name = 'Peden' AND T1.last_name = 'Oldfield'
CREATE TABLE current ( gender_bio TEXT, -- Example Values: `M`, `F` | Value Statics: Total count 541 - Distinct count 2 - Null count 0 suffix_name TEXT, -- Example Values: `Jr.`, `III`, `II` | Value Statics: Total count 20 - Distinct count 3 - Null count 521 house_history_id REAL, -- birthday_bio DATE, -- ...
simpson_episodes
What are the keywords of the episode "Take My Life, Please"?
episode "Take My Life, Please" refers to title = 'Take My Life, Please'
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id WHERE T1.title = 'Take My Life, Please';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
How many Yelp businesses are opened 24 hours?
open 24 hours refers to attribute_name = 'Open 24 Hours' AND attribute_value = 'true';
SELECT COUNT(T2.business_id) FROM Attributes AS T1 INNER JOIN Business_Attributes AS T2 ON T1.attribute_id = T2.attribute_id WHERE T1.attribute_name LIKE 'Open 24 Hours' AND T2.attribute_value LIKE 'TRUE'
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
simpson_episodes
How many votes of 5-star did the episode "Lisa the Drama Queen" receive?
episode "Lisa the Drama Queen" refers to title = 'Lisa the Drama Queen';
SELECT SUM(T2.votes) FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'Lisa the Drama Queen' AND T2.stars = 5;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
simpson_episodes
What are the keywords of the least popular episode?
least popular episode refers to MIN(votes)
SELECT T2.keyword FROM Episode AS T1 INNER JOIN Keyword AS T2 ON T1.episode_id = T2.episode_id ORDER BY T1.votes LIMIT 1;
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
How many more "buffets" than "gyms" in Yelp business?
buffets refers to category_name = 'Buffets'; gyms refers to category_name = 'Gyms'; difference = SUBTRACT(SUM(category_name = 'Buffets'), SUM(category_name = 'Gyms'));
SELECT SUM(CASE WHEN T1.category_name LIKE 'Buffets' THEN 1 ELSE 0 END) - SUM(CASE WHEN T1.category_name LIKE 'Gyms' THEN 1 ELSE 0 END) FROM Categories AS T1 INNER JOIN Business_Categories AS T2 ON T1.category_id = T2.category_id
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...
disney
How many voice-actors were involved in the Bambi movie?
Bambi is the name of the movie which refers to movie = 'Bambi';
SELECT COUNT(DISTINCT 'voice-actor') FROM `voice-actors` WHERE movie = 'Bambi'
CREATE TABLE movies_total_gross ( MPAA_rating TEXT, -- Example Values: `G`, ``, `Not Rated`, `PG`, `R` | Value Statics: Total count 579 - Distinct count 6 - Null count 0 release_date TEXT, -- total_gross TEXT, -- foreign key (movie_title) references characters(movie_title), movie_title TEXT, -- genre TEX...
simpson_episodes
In 2010, which episode did Joel H. Cohen win an award for?
In 2010 refers to year = 2010
SELECT T2.title FROM Award AS T1 INNER JOIN Episode AS T2 ON T1.episode_id = T2.episode_id WHERE SUBSTR(T1.year, 1, 4) = '2010' AND T1.person = 'Joel H. Cohen';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
authors
Mention the name of author for paper id 5 and state the keyword of this page.
null
SELECT T1.Name, T3.Keyword FROM Author AS T1 INNER JOIN PaperAuthor AS T2 ON T1.Id = T2.AuthorId INNER JOIN Paper AS T3 ON T2.PaperId = T3.Id WHERE T2.PaperId = 5
CREATE TABLE Journal ( FullName TEXT, -- ShortName TEXT, -- HomePage TEXT, -- Id INTEGER constraint Journal_pk primary key, ); CREATE TABLE Conference ( ShortName TEXT, -- Id INTEGER constraint Conference_pk primary key, HomePage TEXT, -- FullName TEXT, -- ); CREATE TABLE Paper ( Title TEXT, -- ...
simpson_episodes
What is the difference between the number of votes for 1-star vs. 10-star for the episode "The Burns and the Bees"?
1-star refers to stars = 1; 10-star refers to stars = 10; episode "The Burns and the Bees" refers to title = 'The Burns and the Bees'; difference refers to SUBTRACT(votes when stars = 1, votes when stars = 10)
SELECT SUM(CASE WHEN T2.stars = 10 THEN T2.votes ELSE 0 END) - SUM(CASE WHEN T2.stars = 1 THEN T2.votes ELSE 0 END) AS Difference FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T1.title = 'The Burns and the Bees';
CREATE TABLE Keyword ( foreign key (episode_id) references Episode(episode_id), keyword TEXT, -- primary key (episode_id, keyword), episode_id TEXT, -- ); CREATE TABLE Vote ( foreign key (episode_id) references Episode(episode_id), votes INTEGER, -- episode_id TEXT, -- percent REAL, -- stars INTEGER...
public_review_platform
In which year did the user who gave the most number of "5" star reviews join the Yelp?
year the user join the Yelp refers to user_yelping_since_year; star reviews refers to review_stars;
SELECT T2.user_yelping_since_year FROM Reviews AS T1 INNER JOIN Users AS T2 ON T1.user_id = T2.user_id WHERE T1.review_stars = 5 GROUP BY T2.user_yelping_since_year ORDER BY COUNT(T1.review_stars) DESC LIMIT 1
CREATE TABLE Attributes ( attribute_name TEXT, -- attribute_id INTEGER constraint Attributes_pk primary key, ); CREATE TABLE Elite ( year_id INTEGER constraint Elite_Years_year_id_fk references Years, -- Example Values: `2010`, `2011`, `2012`, `2013`, `2014` | Value Statics: Total count 16366 - Distinct count 10 ...