db_id
stringclasses
68 values
question
stringlengths
24
325
evidence
stringlengths
0
580
SQL
stringlengths
23
728
simpson_episodes
State the number of votes for episode with rating of 7 and above.
rating of 7 and above refers to rating > 7.0
SELECT votes FROM Episode WHERE rating > 7;
simpson_episodes
How many title's crew members are working from Casting Department?
working from Casting Department refers to category = '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';
simpson_episodes
How many additional timers were born in USA?
additional timers refers to role = 'additional timer'; born in USA refers to birth_country = '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';
simpson_episodes
Write down the summary of episode whereby it has crew members that are not included in the credit list.
are not included in the credit list refers to credited = ''
SELECT T1.summary FROM Episode AS T1 INNER JOIN Credit AS T2 ON T1.episode_id = T2.episode_id WHERE T2.credited = 'false';
simpson_episodes
List down the rating of episodes that were produced by Jason Bikowski.
produced by Jason Bikowski refers to person = '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';
simpson_episodes
What is the average heights of crew members from Animation Department?
from Animation Department refers to category = 'Animation Department'; AVG(height_meters) where category = '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';
simpson_episodes
What is the character that won the award in Primetime Emmy 2009?
won the award in Primetime Emmy 2009 refers to award_category = 'Primetime Emmy' and year = 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';
simpson_episodes
What are the characters that were nominated for Primetime Emmy Award from 2009 to 2010 but did not win?
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'
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';
simpson_episodes
Calculate the total votes of episodes that Adam Kuhlman had involved.
Adam Kuhlman had involved refers to person = 'Adam Kuhlman'
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';
simpson_episodes
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
What is the percentage of star score 5 that was collected by title "Sex, Pies and Idiot Scrapes"?
percentage = DIVIDE(SUM(stars = 5), COUNT(stars)) as percentage
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';
simpson_episodes
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
Write down all the keywords for winner of "WGA Award (TV)" award.
winner of "WGA Award (TV)" award refers to award_category = 'WGA Award (TV)' and result = 'Winner'
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)';
simpson_episodes
State the birth place of co-executive producer for nominee of "Outstanding Animated Program (For Programming Less Than One Hour)" award.
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'
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';
simpson_episodes
Sum up the votes from star 1 to 5 for all of the contestants in Blimp Award.
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
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;
simpson_episodes
Calculate the total rating of winners in OFTA Television Award and 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)'
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)');
simpson_episodes
How many episodes have the star score greater than 8?
star score greater than 8 refers to stars > 8
SELECT COUNT(DISTINCT episode_id) FROM Vote WHERE stars > 8;
simpson_episodes
Which episode has the highest number of vote of the star score?
highest number of vote of the star score refers to max(votes)
SELECT episode_id FROM Vote ORDER BY votes DESC LIMIT 1;
simpson_episodes
How many episodes have the keyword "2d animation"?
SELECT COUNT(episode_id) FROM Keyword WHERE keyword = '2d animation';
simpson_episodes
Name the organization which hold the award id 328.
SELECT organization FROM Award WHERE award_id = 328;
simpson_episodes
How many awards classified as "Primetime Emmy" category?
category refers to award_category
SELECT COUNT(award_id) FROM Award WHERE award_category = 'Primetime Emmy';
simpson_episodes
List out the birth name of crews who are co-executive producer and higher than 1.60 meters.
co-executive producer refers to role = 'co-executive producer'; higher than 1.60 meters refers to height_meters > 1.60
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;
simpson_episodes
Calculate the percentage of the nominees who were born in USA.
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%
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';
simpson_episodes
Calculate the percentage of the winners who are higher than 1.75 meters.
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%
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';
simpson_episodes
List out the title of episodes which have star score of 2.
star score of 2 refers to stars = 2
SELECT T1.title FROM Episode AS T1 INNER JOIN Vote AS T2 ON T2.episode_id = T1.episode_id WHERE T2.stars = 2;
simpson_episodes
List out the star scores of episode which has title of "How the Test Was Won".
star scores refers to stars
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';
simpson_episodes
List out the names of the awarded character in the awards held in 2009.
in 2009 refers to year = 2009; name of awarded character refers to character
SELECT T2.character FROM Award AS T1 INNER JOIN Character_Award AS T2 ON T1.award_id = T2.award_id WHERE T1.year = 2009;
simpson_episodes
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
What is the awarded category that the awarded character Lenny won?
awarded category refers to award_category
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';
simpson_episodes
What is the name of actor who took the role Smithers?
name refers to person; the role Smithers refers to character = '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';
simpson_episodes
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
What are the keywords of the episodes which have the air date in 2008?
have air date in 2008 refers to air_date LIKE '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';
simpson_episodes
What is the total number of episode with a rating below 7?
rating below 7 refers to rating < 7
SELECT COUNT(episode_id) FROM Episode WHERE rating < 7;
simpson_episodes
List down the names of person born in California, USA.
California refers to birth_region = 'California'; USA refers to birth_country = 'USA'
SELECT name FROM Person WHERE birth_region = 'California' AND birth_country = 'USA';
simpson_episodes
In between the episode 5 and10 of season 2, how many of them are credited for 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'
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';
simpson_episodes
What is the episode ID that received 2 stars and 9 votes?
2 stars refers to stars = 2; 9 votes refers to votes = 9
SELECT episode_id FROM Vote WHERE stars = 2 AND votes = 9;
simpson_episodes
Give the title of the episode won in Primetime Emmy Awards 2009.
won refers to result = 'Winner'; in Primetime Emmy Awards refers to organization = 'Primetime Emmy Awards'; 2009 refers to year = 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';
simpson_episodes
List down the episode ID of episodes aired in 2008 with 5 stars and below.
aired in 2008 refers to air_date LIKE '2008%'; 5 stars and below refers to stars < 5
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;
simpson_episodes
Among the episode with highest votes, what is the category credited to Carlton Batten?
highest votes refers to max(votes); to Carlton Batten refers to person = '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;
simpson_episodes
Among the episodes aired in 2008 with votes ranges from 920 to 950, list their percent.
aired in 2008 refers to air_date LIKE '2008%'; votes ranges from 920 to 950 refers to votes BETWEEN 920 AND 950
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;
simpson_episodes
List the episode ID and title of episode where casting was credited to Bonita Pietila.
was credited refers to credited = 'true'; to Bonita Pietila refers to person = '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';
simpson_episodes
In episode nominated in Annie Awards, how many of the episodes have a percent greater than 6?
nominated refers to result = 'Nominee'; Annie Awards refers to organization = 'Annie Awards'; percent greater than 6 refers to percent > 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;
simpson_episodes
What is the title of episode nominated for WGA Award (TV) with votes greater than 1000?
nominated refers to result = 'Nominee'; WGA Award (TV) refers to award_category = 'WGA Award (TV)'; votes greater than 1000 refers to votes > 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';
simpson_episodes
Among the people in Animation Department, who are credited for additional time in the episode titled by "How the Test Was Won"?
Animation Department refers to category = 'Animation Department'; credited refers to credited = 'true'; for additional timer refers to role = 'additional timer'
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';
simpson_episodes
List the stars of episodes aired in November 2008.
in November 2008 refers to air_date LIKE '2008-11%'
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';
simpson_episodes
What is the title of episode with 5 stars and nominated for Prism Award which is aired on April 19, 2009?
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'
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';
simpson_episodes
In episode with the highest votes, list the category of awards it is nominated for.
highest votes refers to max(votes); nominated refers to result = 'Nominee'
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;
simpson_episodes
In episodes aired in 2009, how many of them are credited to Sam Im for 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'
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';
simpson_episodes
List the title of the episode with stars greater than the 70% of average stars of all episodes.
stars greater than the 70% of average stars refers to stars > multiply(avg(stars), 0.7)
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 );
simpson_episodes
In year 2009, what is the percentage of the episode titled by "Gone Maggie Gone" being nominated?
being nominated refers to result = 'Nominee'; percentage = divide(count(result = 'Nominee'), count(result)) * 100%
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;
student_loan
For the students who have been absent from school for the longest time, how many months have they been absent?
absent from school for the longest time refers to MAX(month)
SELECT MAX(month) FROM longest_absense_from_school
student_loan
How many students belong to the navy department?
belong to the navy department refers to organ = 'navy';
SELECT COUNT(name) FROM enlist WHERE organ = 'navy'
student_loan
How many female students are disabled?
females students are disabled refers to name that appeared in both disabled and male tables
SELECT COUNT(name) FROM disabled WHERE name NOT IN ( SELECT name FROM male )
student_loan
Please list all the female students that have filed for bankruptcy.
females students have filed for bankruptcy refers to name that appeared in both filed_for_bankrupcy and male tables
SELECT name FROM filed_for_bankrupcy WHERE name NOT IN ( SELECT name FROM male )
student_loan
Name all students enlisted in the foreign legion.
in the foreign legion organ = 'foreign_legion';
SELECT name FROM enlist WHERE organ = 'foreign_legion'
student_loan
Does student348 have a due payment?
payment due refers to bool = 'pos' means the student has payment due , bool = 'neg' means the student does not have payment due;
SELECT bool FROM no_payment_due WHERE name = 'student348'
student_loan
Which school is student829 enrolled in?
SELECT school FROM enrolled WHERE name = 'student829'
student_loan
How many months has student217 been absent?
SELECT month FROM longest_absense_from_school WHERE name = 'student217'
student_loan
Which organization did student285 enlist?
SELECT organ FROM enlist WHERE name = 'student285'
student_loan
How many male students have no due payments?
have no due payments refers to bool = 'neg';
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T1.name = T2.name WHERE T1.bool = 'neg'
student_loan
What is the total number of students in the school?
SELECT COUNT(name) FROM person
student_loan
How many students were absence for 4 month?
absence for 4 month refers to month = 4;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 4
student_loan
What is the number of unemployed and bankrupt students?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name
student_loan
How many unemployed and bankrupt students that have payment dues?
have payment dues refers to bool = 'pos'
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name INNER JOIN no_payment_due AS T3 ON T2.name = T3.name WHERE T3.bool = 'pos'
student_loan
What is the employment, disability, gender and school debt status for student180 and student117?
school debt status refers to bool; bool = 'pos' means has payment due; bool = 'neg' means doesn't has payment due; student appear in male.name means he is a male; student does not appear in male.name means she is a female;
SELECT ( SELECT COUNT(name) FROM disabled WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM unemployed WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM male WHERE name IN ('student180', 'student117') ), ( SELECT COUNT(name) FROM no_payment_due WHERE name IN ('student180', 'student117'))
student_loan
How many female students joined a marines and air force organization?
joined a marines refers to organ = 'marines'; air force organization refers to organ = 'air_force';
SELECT COUNT(name) FROM enlist WHERE organ IN ('marines', 'air_force') AND name NOT IN ( SELECT name FROM male )
student_loan
How many female students are not joining any of the organization?
female students refers to enlist.name who are NOT in male.name
SELECT COUNT(name) FROM person WHERE name NOT IN ( SELECT name FROM male ) AND name NOT IN ( SELECT name FROM enrolled )
student_loan
What is the average absence period of a student?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school
student_loan
What is the average of absence for an employed students?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school WHERE name NOT IN ( SELECT name FROM unemployed )
student_loan
What is the average absence period of a disabled student?
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
student_loan
How many students enlisted in the fire-department?
enlisted in the fire-department refers to organ = 'fire_department';
SELECT COUNT(name) FROM enlist WHERE organ = 'fire_department'
student_loan
How many students who have never been absent from school?
have never been absent refers to `month` = 0;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 0
student_loan
How many students have been absent above 2 months?
absent above 2 months refers to month > 2;
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 2
student_loan
State the number of students do not have payment due.
do not have payment due refers to bool = 'neg';
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'neg'
student_loan
Give the number of students who have payment due.
who have payment due refers to bool = 'pos';
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'pos'
student_loan
Mention the name of disabled students who have never been absent from school.
never been absent from school refers to month = 0
SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T2.month = 0
student_loan
How many unemployed students are enlisted in the navy organization?
enlisted in the navy organization refers to organ = 'navy';
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'
student_loan
Count the number of male students who belong to foreign legion.
belong to foreign legion refers to organ = 'foreign_legion';
SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'foreign_legion'
student_loan
List out the number of female students who enlisted in the air force.
enlisted in the air force refers to organ = 'air_force';
SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' AND name NOT IN ( SELECT name FROM male )
student_loan
State name of disabled students who have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name ORDER BY T2.month DESC LIMIT 1
student_loan
State the unemployed students who enlisted in marines.
enlisted in marines refers to organ = 'marines';
SELECT T1.name FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'
student_loan
Calculate the average duration of absense of disabled students.
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
student_loan
How many unemployed disabled students have been absent for 8 months from school?
absent for 8 months refers to month = 8;
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name INNER JOIN disabled AS T3 ON T2.name = T3.name WHERE T1.month = 8
student_loan
State name of unemployed students who have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1
student_loan
Mention the name of unemployed students who have never been absent from school.
have never been absent from school refers to month = 0
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.month = 0
student_loan
How many disabled students have been absent for 3 months from school?
have been absent for 3 months from school refers to month = 3
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month = 3
student_loan
Mention the name of students who filed for bankruptcy and have never been absent from school.
have never been absent refers to month = 0;
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name WHERE T1.month = 0
student_loan
State name of students who filed for bankruptcy and have the longest duration of absense from school.
longest duration of absense refers to MAX(month)
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name ORDER BY T1.month DESC LIMIT 1
student_loan
How many students are disabled?
SELECT COUNT(name) FROM disabled
student_loan
How many students have been absents for more than 6 months?
absents for more than 6 months refers to month > 6
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 6
student_loan
Which students have absents the most?
absents the most refers to MAX(month)
SELECT name FROM longest_absense_from_school WHERE month = ( SELECT MAX(month) FROM longest_absense_from_school )
student_loan
How many students are enlisted in the army?
enlisted in the army refers to organ = 'army';
SELECT COUNT(name) FROM enlist WHERE organ = 'army'
student_loan
Find the average number of absences for each student.
average refers to DIVIDE(SUM(month), COUNT(name))
SELECT AVG(month) FROM longest_absense_from_school
student_loan
Sum up the number of students enlisted in foreign legion, peace corps and army.
enlisted in foreign legion refers to organ = 'foreign_legion'; peace corps refers to organ = 'peace_corps'; army refers to organ = 'army'
SELECT COUNT(name) FROM enlist WHERE organ IN ('army', 'peace_corps', 'foreign_legion')
student_loan
Among the students enlisted in marines, how many of them are disabled?
enlisted in marines refers to organ = 'marines';
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.organ = 'marines'
student_loan
How many unemployed students still have payment due?
still have payment due refers to bool = 'pos'
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'
student_loan
Which female students had never been absent?
had never been absent refers to month = 0
SELECT T2.name FROM male AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name <> T2.name WHERE T2.month = 0
student_loan
Which school has the highest number of disabled students?
highest number of disabled students refers to MAX(COUNT(disabled.name))
SELECT T.school FROM ( SELECT T2.school, COUNT(T2.name) AS num FROM disabled AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name GROUP BY T2.school ) T ORDER BY T.num DESC LIMIT 1
student_loan
List all the organisations of students who filed for bankcrupcy.
organization refers to organ; students who filed for bankrupcy refers to file_for_bankrupcy.name
SELECT T2.organ FROM filed_for_bankrupcy AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name
student_loan
How many male students join more than one organization?
more than one organization refers to COUNT(organ) > 1
SELECT COUNT(T.a) FROM ( SELECT COUNT(DISTINCT T1.name) AS a, COUNT(T2.organ) AS num FROM male AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name GROUP BY T1.name ) T WHERE T.num > 1