db_id
stringclasses
69 values
schema
stringclasses
69 values
m_schema
stringclasses
69 values
question
stringlengths
24
325
sql
stringlengths
23
804
evidence
stringlengths
0
673
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students are there that have been absent for 6 months?
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.`name` = T2.name WHERE T1.`month` = 6
absent for 6 months refers to month = 6;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Count the number of students from UCSD enlisted in the peace corps.
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.`name` = T2.`name` WHERE T2.school = 'ucsd' AND T1.organ = 'peace_corps'
in the peace corps refers to organ = 'peace_corps'; from UCSD refers to school = 'ucsd';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Student21 is enlisted in which organization and has the student been absent?
SELECT T2.month, T1.organ FROM enlist AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.`name` = T2.`name` WHERE T1.name = 'student21'
organization refers to organ
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the percentage ratio of students who are enlisted in foreign legions that have a due payment?
SELECT CAST(SUM(IIF(T1.bool = 'pos', 1, 0)) AS REAL) * 100 / SUM(IIF(T1.bool = 'neg', 1, 0)) FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'foreign_legion'
have a due payment refers to bool = 'pos'; in foreign legions refers to organ = 'foreign_legion'; ratio refers to DIVIDE(COUNT(bool = 'pos'), COUNT(bool = 'neg'))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What percentage of students who enlisted in the navy make up the number of students enrolled in OCC?
SELECT CAST(SUM(IIF(T1.school = 'occ', 1.0, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T2.organ = 'navy'
in the navy refers to organ = 'navy'; enrolled in OCC refers to school = 'occ'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List out student IDs that have the longest absence duration from school.
SELECT name FROM longest_absense_from_school WHERE `month` = ( SELECT MAX(month) FROM longest_absense_from_school )
longest absence duration refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the total number of students in the school?
SELECT COUNT(name) FROM person
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the longest students absence duration from school?
SELECT name, month FROM longest_absense_from_school WHERE `month` = ( SELECT MAX(month) FROM longest_absense_from_school )
longest students absence duration MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students were absence for 4 month?
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 4
absence for 4 month refers to month = 4;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the 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
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Does disable students join organization. If yes, please indicate the organization joined by the students.
SELECT DISTINCT T2.organ FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name`
organization refers to organ
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed and bankrupt students that have payment dues?
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'
have payment dues refers to bool = 'pos'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Please check if student 124 is disabled male.
SELECT IIF(T2.name IS NULL, 'female', 'male') FROM male AS T1 LEFT JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.name = 'student124'
if student name appear in disabled then student is disabled and vice versa; if student name appear in male then student is male and vice versa
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the employment, disability, gender and school debt status for student180 and student117?
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', 's...
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;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many female students joined a marines and air force organization?
SELECT COUNT(name) FROM enlist WHERE organ IN ('marines', 'air_force') AND name NOT IN ( SELECT name FROM male )
joined a marines refers to organ = 'marines'; air force organization refers to organ = 'air_force';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List out the organization joined and school enrolled by student27, student17 and student101?
SELECT T1.school, T2.organ FROM enrolled AS T1 INNER JOIN enlist AS T2 ON T1.`name` = T2.`name` WHERE T1.`name` IN ('student27,student17,studetn101')
organization joined refers to organ
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the ratio of disable female to male students?
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T2.name) FROM disabled AS T1 LEFT JOIN male AS T2 ON T1.`name` = T2.`name`
ratio refers to DIVIDE(COUNT(name not from male), COUNT(name from male))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many female students are not joining any of the organization?
SELECT COUNT(name) FROM person WHERE name NOT IN ( SELECT name FROM male ) AND name NOT IN ( SELECT name FROM enrolled )
female students refers to enlist.name who are NOT in male.name
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List out all bankrupt students that are able to make payment before due?
SELECT T1.name FROM filed_for_bankrupcy AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'
make payment before due refers to bool = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the average absence period of a student?
SELECT AVG(month) FROM longest_absense_from_school
average refers to DIVIDE(SUM(month), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the average of absence for an employed students?
SELECT AVG(month) FROM longest_absense_from_school WHERE name NOT IN ( SELECT name FROM unemployed )
average refers to DIVIDE(SUM(month), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the average absence period of a disabled student?
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
average refers to DIVIDE(SUM(month), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which organization does student 313 belong to?
SELECT organ FROM enlist WHERE name = 'studenT113'
organization refers to organ
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students enlisted in the fire-department?
SELECT COUNT(name) FROM enlist WHERE organ = 'fire_department'
enlisted in the fire-department refers to organ = 'fire_department';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students who have never been absent from school?
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 0
have never been absent refers to `month` = 0;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students have been absent above 2 months?
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 2
absent above 2 months refers to month > 2;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
State the number of students do not have payment due.
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'neg'
do not have payment due refers to bool = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Give the number of students who have payment due.
SELECT COUNT(name) FROM no_payment_due WHERE bool = 'pos'
who have payment due refers to bool = 'pos';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Mention the name of disabled students who have never been absent from school.
SELECT T1.name FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T2.month = 0
never been absent from school refers to month = 0
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students are enlisted in the navy organization?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'
enlisted in the navy organization refers to organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Count the number of male students who belong to 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'
belong to foreign legion refers to organ = 'foreign_legion';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List out the number of female students who enlisted in the air force.
SELECT COUNT(name) FROM enlist WHERE organ = 'air_force' AND name NOT IN ( SELECT name FROM male )
enlisted in the air force refers to organ = 'air_force';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
State name of disabled students who have the longest duration of absense from school.
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
longest duration of absense refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
State the unemployed students who enlisted in marines.
SELECT T1.name FROM unemployed AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'
enlisted in marines refers to organ = 'marines';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the average duration of absense of disabled students.
SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
average refers to DIVIDE(SUM(month), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the percentage of unemployed students who have been absent for 5 months from school?
SELECT CAST(SUM(IIF(T1.month > 5, 1, 0)) AS REAL) * 100 / COUNT(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name
percentage refers to DIVIDE(COUNT(month > 5), COUNT(month))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed disabled students have been absent for 8 months from school?
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
absent for 8 months refers to month = 8;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
State name of unemployed students who have the longest duration of absense from school.
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
longest duration of absense refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Mention the name of unemployed students who have never been absent from school.
SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.month = 0
have never been absent from school refers to month = 0
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many disabled students have been absent for 3 months from school?
SELECT COUNT(T1.name) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.month = 3
have been absent for 3 months from school refers to month = 3
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Mention the name of students who filed for bankruptcy and have never been absent from school.
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
have never been absent refers to month = 0;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
State name of students who filed for bankruptcy and have the longest duration of absense from school.
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
longest duration of absense refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the gender of student1000?
SELECT IIF(T.result = 0, 'female', 'male') AS re FROM ( SELECT COUNT(name) AS result FROM male WHERE name = 'studenT1000' ) T
student name appear in Male table means student is a male, student does not appear in Male table means student is a female
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are disabled?
SELECT COUNT(name) FROM disabled
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students have been absents for more than 6 months?
SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 6
absents for more than 6 months refers to month > 6
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which students have absents the most?
SELECT name FROM longest_absense_from_school WHERE month = ( SELECT MAX(month) FROM longest_absense_from_school )
absents the most refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are enlisted in the army?
SELECT COUNT(name) FROM enlist WHERE organ = 'army'
enlisted in the army refers to organ = 'army';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Find the average number of absences for each student.
SELECT AVG(month) FROM longest_absense_from_school
average refers to DIVIDE(SUM(month), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Sum up the number of students enlisted in foreign legion, peace corps and army.
SELECT COUNT(name) FROM enlist WHERE organ IN ('army', 'peace_corps', 'foreign_legion')
enlisted in foreign legion refers to organ = 'foreign_legion'; peace corps refers to organ = 'peace_corps'; army refers to organ = 'army'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students enlisted in marines, how many of them are disabled?
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.organ = 'marines'
enlisted in marines refers to organ = 'marines';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students still have payment due?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'
still have payment due refers to bool = 'pos'
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which female students had never been absent?
SELECT T2.name FROM male AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name <> T2.name WHERE T2.month = 0
had never been absent refers to month = 0
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Which school has the highest number of disabled students?
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
highest number of disabled students refers to MAX(COUNT(disabled.name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List all the organisations of students who filed for bankcrupcy.
SELECT T2.organ FROM filed_for_bankrupcy AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name
organization refers to organ; students who filed for bankrupcy refers to file_for_bankrupcy.name
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many male students join more than one organization?
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
more than one organization refers to COUNT(organ) > 1
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List all the navy students who are disabled.
SELECT T1.name FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'navy'
navy students refers to organ = 'navy'; disabled student refers to disabled.name
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many SMC's students that absent for 7 months?
SELECT COUNT(T1.name) FROM enrolled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name WHERE T1.school = 'smc' AND T2.month = 7
SMC's students refers to school = 'smc'; absent for 7 months refers to month = 7
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List all the disabled female students.
SELECT T1.name FROM disabled AS T1 INNER JOIN male AS T2 ON T1.name <> T2.name
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the ratio between unemployed students and disabled students.
SELECT CAST(( SELECT COUNT(name) FROM unemployed ) AS REAL ) / ( SELECT COUNT(name) FROM disabled )
ratio refers to DIVIDE(COUNT(name from unemployed), COUNT(name from disabled))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Find the percentage of male students enlisted in the fire department.
SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name WHERE T1.organ = 'fire_department'
percentage refers to DIVIDE(COUNT(organ = 'fire_department'), COUNT(name))
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students has the longest absense from school for 5 months?
SELECT COUNT(name) FROM longest_absense_from_school WHERE month = 5
absense from school for 5 month refers to month = 5
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are enlisted in the Army organization?
SELECT COUNT(name) FROM enlist WHERE organ = 'army'
enlisted in the army refers to organ = 'army';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are enrolled in UCLA school?
SELECT COUNT(name) FROM enrolled WHERE school = 'ucla'
enrolled in UCLA refers to school = 'ucla';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List at least 5 students who has the longest absense from schoool?
SELECT name FROM longest_absense_from_school ORDER BY month DESC LIMIT 5
longest absense refers to MAX(month)
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many of the students joined two organization?
SELECT COUNT(name) FROM enlist WHERE organ >= 2
joined two organization refers to COUNT(organ) > = 2
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are enlisted in the Navy organization?
SELECT COUNT(name) FROM enlist WHERE organ = 'navy'
enlisted in the navy organization refers to organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many male stuents do not have payment due?
SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'
do not have payment due refers to bool = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are enlisted in the Peace Corps organization are enrolled in UCSD school?
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T1.organ = 'peace_corps' AND T2.school = 'ucsd'
enlisted in the Peace Corps refers to organ = 'peace_corps'; enrolled in UCSD school refers to school = 'ucsd';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the unemployed students, how many of them have no payment due?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg'
have no payment due refers to bool = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many female students have no payment due?
SELECT COUNT(name) FROM no_payment_due WHERE name NOT IN ( SELECT name FROM male )
have no payment due refers to bool = 'neg'; female students refers to name NOT in male table
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students have never been absent?
SELECT COUNT(T2.name) FROM longest_absense_from_school AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.month = 0
never been absent refers to month = 0;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List at least 10 students who have no payment due and are enlisted in Fire Department organization.
SELECT T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.bool = 'neg' AND T2.organ = 'fire_department' LIMIT 10
no payment due refers to bool = 'neg'; organization refers to organ; organ = 'fire_department';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many female students are enlisted in the Navy organization?
SELECT COUNT(name) FROM enlist WHERE organ = 'navy' AND name NOT IN ( SELECT name FROM male )
female students refers to enlist.name who are NOT in male.name; organization refers to organ; organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students are enlisted in the Army organization?
SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.organ = 'army'
organization refers to organ; organ = 'army';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students have payment due?
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'
have payment due refers to bool = 'pos';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List at least 5 students who have payment due and are enlisted in Peace Corps organization?
SELECT T1.name FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T2.organ = 'peace_corps' AND T1.bool = 'pos' LIMIT 5
have payment due refers to bool = 'pos'; organization refers to organ; organ = 'Peace Corps';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many disabled students are female?
SELECT COUNT(name) FROM disabled WHERE name NOT IN ( SELECT name FROM male )
female refers to disabled.name who are NOT in male.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many disabled students have payment due?
SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T2.bool = 'pos'
have payment due refers to bool = 'pos';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the average number of female students who are disabled and who joined Foreign Legion organization.
SELECT CAST(SUM(IIF(T3.name IS NULL, 1, 0)) AS REAL) / COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.organ = 'foreign_legion'
average = DIVIDE(COUNT(disabled.name who are not in male.name WHERE organ = 'foreign_legion'), COUNT(disabled.name)); female students who are disabled refers to disabled.name who are NOT in male.name; organization refers to organ; organ = 'Foreign Legion';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the ratio in percentage between the average number of female and male students who joined Fire Department organization.
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name), CAST(SUM(IIF(T2.name IS NOT NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.organ = 'fire_department'
ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is NOT in male.name), COUNT(enlist.name WHERE organ = 'fire_department),'%'))) AS FEMALE; ratio = CONCAT(MULTIPLY(DIVIDE(COUNT(enlist.name WHERE organ = 'fire_department' which is IN male.name), COUNT(enlist.name WHERE organ = 'fire_...
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students enlisted in the navy?
SELECT COUNT(name) FROM enlist WHERE organ = 'navy'
navy refers to organ = 'navy';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the percentage of students who have never been absent.
SELECT CAST(SUM(IIF(month = 0, 1, 0)) AS REAL) * 100 / COUNT(name) FROM longest_absense_from_school
percentage = CONCAT(DIVIDE(MULTIPLY(COUNT(name WHERE month = 0), 100), COUNT(name)),'%'); never been absent refers to month = 0;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
What is the ratio of students who have payment due and those who do not have payment due?
SELECT CAST(SUM(IIF(`bool` = 'pos', 1, 0)) AS REAL) / SUM(IIF(`bool` = 'neg', 1, 0)) FROM no_payment_due
ratio =  DIVIDE(COUNT(name WHERE `bool` = 'pos'), COUNT(name WHERE `bool` = 'neg')); have payment due refers to `bool` = 'pos'; no payment due refers to `bool` = 'neg';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Provide the students' names and schools who enrolled for 15 months.
SELECT name, school FROM enrolled WHERE month = 15
enrolled for 15 months refers to month = 15;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the average enlisted students per organization.
SELECT CAST(COUNT(NAME) AS REAL) * 100 / COUNT(DISTINCT organ) FROM enlist
average = DIVIDE(FLOOR(COUNT(NAME), COUNT(DISTINCT organ)));
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List down the enrolled schools and duration of student214.
SELECT school, month FROM enrolled WHERE name = 'student214'
enrolled schools refers to school; duration refers to month; student214 is a name of student;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among all students, calculate the percentage of disabled students.
SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name
percentage = CONCAT(DIVIDE(MULTIPLY(COUNT(disabled.name), 100), (COUNT(person.name that is not in disabled.name))),'%');
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among students who have been absent for nine months, how many of them are disabled?
SELECT COUNT(T1.name) FROM disabled AS T1 LEFT JOIN longest_absense_from_school AS T2 ON T2.name = T1.name WHERE T2.month = 9
absent for 9 months refers to month = 9;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List down the student names who did not file for bankruptcy.
SELECT name FROM person WHERE name NOT IN ( SELECT name FROM filed_for_bankrupcy )
students name who did not file a bankruptcy refers to person.name who are NOT in filed_for_bankrupcy.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List any five female students' names who enlisted for the air force.
SELECT T1.name FROM enlist AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T2.name IS NULL AND T1.organ = 'air_force' LIMIT 5
female students refers to enlist.name who are NOT in male.name; air force refers to organ = 'air_force';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the number of students who are not disabled.
SELECT COUNT(CASE WHEN T2.name IS NULL THEN T1.name END) AS "number" FROM person AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name
students who are not disabled refers to person.name who are NOT in disabled.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Define the gender of "student995" and his/her enrolled schools.
SELECT IIF(T2.name IS NULL, 'female', 'male') AS gen , T1.school FROM enrolled AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name WHERE T1.name = 'student995'
male.name = 'student995' means student995's gender is male; if 'student995' can not be found in 'male.name', it means student995 is female;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students with disabilities, list any five students' names who are unemployed.
SELECT T1.name FROM disabled AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name LIMIT 5
students with disabilities who are unemployed refers to disabled.name who are IN unemployed.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many unemployed students filed for bankruptcy?
SELECT COUNT(T1.name) FROM unemployed AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T2.name = T1.name
unemployed students who filed for bankruptcy refers to unemployed.name who are IN filed_for_bankrupcy.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students who have been absent for four months, provide any five students' names and enlisted organizations.
SELECT T2.name, T2.organ FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T2.name = T1.name WHERE T1.month = 4 LIMIT 5
absent for four months refers to month = 4; enlisted organizations refers to organ;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Among the students with payment due, how many of them are unemployed?
SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN unemployed AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'
with payment due refers to bool = 'pos';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Provide the enlisted organizations of student160 and status of his/her payment due.
SELECT T1.organ, T2.bool FROM enlist AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T1.name = 'student160'
enlisted organizations refers to organ; student160 is a name of student; status of his or her payment due is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
List any ten male students who enlisted for foreign legion.
SELECT T1.name FROM enlist AS T1 INNER JOIN male AS T2 ON T2.name = T1.name WHERE T1.organ = 'foreign_legion' LIMIT 10
male students are mentioned in male.name; foreign legion refers to organ = 'foreign_legion';
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
Calculate the percentage of female students.
SELECT CAST(SUM(IIF(T2.name IS NULL, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name
percentage = CONCAT(DIVIDE(MULTIPLY(COUNT(person.name which is not in male.name)), 100), COUNT(person.name that is IN male.name),'%'); female students refers to person.name who are NOT in male.name;
student_loan
CREATE TABLE bool ( "name" TEXT default '' not null primary key ); CREATE TABLE person ( "name" TEXT default '' not null primary key ); CREATE TABLE disabled ( "name" TEXT default '' not null primary key, foreign key ("name") references person ("name") on update...
【DB_ID】 student_loan 【Schema】 # Table: main.bool [ (name:TEXT, Primary Key, Examples: [neg, pos]) ] # Table: main.disabled [ (name:TEXT, Primary Key, Examples: [student114, student125, student142]) ] # Table: main.enlist [ (name:TEXT, Examples: [student40, student51, student109]), (organ:TEXT, Examples: [fire_departmen...
How many students are filed for bankruptcy?
SELECT COUNT(name) FROM filed_for_bankrupcy