1sf/bird-sql-train-with-schema huggingface dataset:
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List out female students that enrolled in occ school and ulca?
Evidence: female students refers to enrolled.name who are NOT in male.name; occ school and ulca refers to school IN('occ', 'ulca');
SQL: SELECT name FROM enrolled WHERE school IN ('occ', 'ulca') AND name NOT IN ( SELECT name FROM male )
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the school and organization enrolled by student211?
Evidence: organization refers to organ; student211 is a name of student;
SQL: SELECT T2.school, T1.organ FROM enlist AS T1 INNER JOIN enrolled AS T2 ON T2.name = T1.name WHERE T1.name = 'student211'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many male students filed for bankruptcy as compare to female students?
Evidence: difference = SUBTRACT(COUNT(filed_for_bankrupcy.name who are In male.name), COUNT(filed_for_bankrupcy.name who are NOT in male.name)); male students are mentioned in male.name; female students refers to filed_for_bankrupy.name who are NOT in male.name;
SQL: SELECT COUNT(T2.name) - SUM(IIF(T2.name IS NULL, 1, 0)) AS num FROM filed_for_bankrupcy AS T1 LEFT JOIN male AS T2 ON T2.name = T1.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the average absent month for a unemployed male students?
Evidence: average = DIVIDE(SUM(month), COUNT(unemployed.name who are in male.name)); unemployed male students refers to unemployed.name who are IN male.name;
SQL: SELECT AVG(T2.month) AS avg FROM unemployed AS T1 INNER JOIN longest_absense_from_school AS T2 ON T2.name = T1.name INNER JOIN male AS T3 ON T3.name = T2.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the percentage difference between the attendence of disabled and non-disable students? Do the disable students show better attendance than non-disable students?
Evidence: difference = MULTIPLY(DIVIDE(SUBTRACT(COUNT(longest_absense_from_school.name that is in disabled.name), COUNT(longest _absense_from_school.name that is NOT in disabled.name), longest _absense_from_school.name), 100)); IF COUNT(longest_absense_from_school.name that is in disabled.name) < COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means, the disabled students have better attendance than non-disabled students; IF COUNT(longest_absense_from_school.name that is in disabled.name) > COUNT(longest _absense_from_school.name that is NOT in disabled.name), it means the disabled students do not have a better attendance than non-disabled students;
SQL: SELECT CAST((SUM(IIF(T2.name IS NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0))) AS REAL) * 100 / COUNT(T1.name), IIF(SUM(IIF(T2.name IS NOT NULL AND T1.month = 0, 1, 0)) - SUM(IIF(T2.name IS NULL AND T1.month = 0, 1, 0)) > 0, 'YES', 'NO') AS isHigh FROM longest_absense_from_school AS T1 LEFT JOIN disabled AS T2 ON T2.name = T1.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Calculate the average duration of absense of disabled male students.
Evidence: average duration = DIVIDE(SUM(month), COUNT(month)); duration of absence refers to month; disabled male students refers to disabled.name who are IN male.name;
SQL: SELECT AVG(T1.month) FROM longest_absense_from_school AS T1 INNER JOIN disabled AS T2 ON T2.name = T1.name INNER JOIN male AS T3 ON T3.name = T2.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Calculate the ratio of unemployed students who have never been absent from school.
Evidence: ratio = CONCAT(DIVIDE(MULTIPLY(COUNT(unemployed.name WHERE month = 0), 100), COUNT(month)),'%'); unemployed students who have never been absent from school refers to (unemployed.name WHERE month = 0);
SQL: SELECT CAST(SUM(IIF(T2.month = 0, 1, 0)) AS REAL) * 100 / COUNT(T1.name) FROM unemployed AS T1 INNER JOIN longest_absense_from_school AS T2 ON T2.name = T1.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State the number of male students who do not have payment due.
Evidence: do not have payment due refers to bool = 'neg';
SQL: SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN male AS T2 ON T2.name = T1.name WHERE T1.bool = 'pos'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State the number of students who filed for bankruptcy and have payment due.
Evidence: have payment due refers to bool = 'pos';
SQL: SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN no_payment_due AS T2 ON T2.name = T1.name WHERE T2.bool = 'pos'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the status of payment of student 124?
Evidence: status of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student124 is a name of student;
SQL: SELECT `bool` FROM no_payment_due WHERE name = 'student124'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State the number of disabled students who have payment due.
Evidence: have payment due refers to bool = 'pos';
SQL: SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.bool = 'neg'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State name of students who have the longest duration of absense from school and do not have payment due.
Evidence: longest duration of absence from school refers to MAX(month); do not have payment due refers to bool = 'neg';
SQL: SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'neg' ORDER BY T1.month DESC LIMIT 1
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State name of students who have been absent for 5 months from school and do not have payment due.
Evidence: absent for 5 months refers to month = 5; do not have payment due refers to bool = 'neg';
SQL: SELECT T1.name FROM longest_absense_from_school AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T1.month = 5 AND T2.bool = 'neg'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List out the number of disabled students who enlisted in marines.
Evidence: marines refers to organ = 'marines';
SQL: SELECT COUNT(T1.name) FROM disabled AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'marines'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List out the number of students who have the longest duration of absense from school and enlisted in the peace corps.
Evidence: longest duration of absence refers to MAX(month); peace corps refers to organ = 'peace_corps';
SQL: SELECT COUNT(T1.NAME) FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'peace_corps' ORDER BY T1.month DESC LIMIT 1
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List out the number of students who filed for bankruptcy and enlisted in navy.
Evidence: navy refers to organ = 'navy';
SQL: SELECT COUNT(T1.name) FROM enlist AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name WHERE T1.organ = 'navy'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Give the number of students who enlisted in marines and have payment due.
Evidence: marines refers to organ = 'marines'; have payment due refers to bool = 'pos';
SQL: SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos' AND T2.organ = 'marines'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Calculate the ratio of disabled students who have never been absent from school.
Evidence: ratio = MULTIPLY(DIVIDE(SUM(month = 0), COUNT(disabled.name)), 100); never been absent from school refers to month = 0;
SQL: SELECT 100 * SUM(IIF(T2.month = 0, 1, 0)) AS num FROM disabled AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many students in the Air Force?
Evidence: Air Force refers to organ = 'air_force';
SQL: SELECT COUNT(name) FROM enlist WHERE organ = 'air_force'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many students have been absent less than 4 months?
Evidence: absent less than 4 months refers to month < 4;
SQL: SELECT COUNT(name) FROM longest_absense_from_school WHERE month < 4
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Count the number of female students who belong to marines organization.
Evidence: female students refers to enlist.name who are NOT in male.name; organization refers to organ; organ = 'marines';
SQL: SELECT COUNT(*) FROM person AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T2.organ = 'marines' AND T3.name IS NULL
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Calculate the average duration of absense of female students.
Evidence: average duration = DIVIDE(SUM(month), COUNT(longest_absence_from_school.name which are NOT in male.name)); female students refers to longest_absence_from_school.name who are NOT in male.name;
SQL: SELECT AVG(T2.month) FROM person AS T1 INNER JOIN longest_absense_from_school AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T3.name IS NULL
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: State name of female students who filed for bankruptcy.
Evidence: female students refers to filed_for_bankrupcy.name who are NOT in male.name;
SQL: SELECT T1.name FROM person AS T1 INNER JOIN filed_for_bankrupcy AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T1.name = T3.name WHERE T3.name IS NULL
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Mention the status of payment of student 299.
Evidence: status of payment is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student299 is a name of student;
SQL: SELECT bool FROM no_payment_due WHERE name = 'student299'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many students are enlisted to the air force?
Evidence: Air Force refers to organ = 'air_force';
SQL: SELECT COUNT(name) FROM enlist WHERE organ = 'air_force'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many students have absent from school?
Evidence: have absent from school refers to month > 1;
SQL: SELECT COUNT(name) FROM longest_absense_from_school WHERE month > 1
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Provide the names of the students enlisted in the fire department.
Evidence: department refers to organ; organ = 'fire_department';
SQL: SELECT name FROM enlist WHERE organ = 'fire_department'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many disabled students have payment due?
Evidence: payment due refers to bool = 'pos';
SQL: SELECT COUNT(T1.name) FROM no_payment_due AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.bool = 'pos'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Among the students that filed for bankruptcy, how many of them have been enrolled in OCC?
Evidence: OCC refers to school = 'occ';
SQL: SELECT COUNT(T1.name) FROM filed_for_bankrupcy AS T1 INNER JOIN enrolled AS T2 ON T1.name = T2.name WHERE T2.school = 'occ'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: How many disabled students are male?
Evidence: male students are mentioned in male.name;
SQL: SELECT COUNT(T1.name) FROM male AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List the names of disabled students enlisted in the navy.
Evidence: navy refers to organ = 'navy';
SQL: SELECT T1.name FROM enlist AS T1 INNER JOIN disabled AS T2 ON T1.name = T2.name WHERE T1.organ = 'navy'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Among the male students, list down the names of students with payment due.
Evidence: male students are mentioned in male.name; with payment due refers to bool = 'pos';
SQL: SELECT T1.name FROM male AS T1 INNER JOIN no_payment_due AS T2 ON T1.name = T2.name WHERE T2.bool = 'pos'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the employment and payment status of student110?
Evidence: employment status is mentioned in unemployment; unemployed.name = 'student110' means the student is unemployed; if 'student110' can not be found in unemployed.name, it means the student is employed; payment status is mentioned in no_payment_due; bool = 'pos' means the student has payment due; bool = 'neg' means the student has no payment due; student110 is a name of student;
SQL: SELECT T1.bool FROM no_payment_due AS T1 INNER JOIN unemployed AS T2 ON T1.name = T2.name WHERE T1.name = 'student110'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: Among all students, calculate the percentage of male students.
Evidence: percentage = MULTIPLY(DIVIDE(COUNT(male.name), COUNT(person.name)), 100); male students are mentioned in male.name;
SQL: SELECT CAST(COUNT(T2.name) AS REAL) * 100 / COUNT(T1.name) FROM person AS T1 LEFT JOIN male AS T2 ON T1.name = T2.name
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: What is the school and gender of student34?
Evidence: male.name = 'student34' means student34's gender is male; if 'student34' can't be found in 'male.name', it means student34 is female; student34 is a name of student;
SQL: SELECT T1.school , IIF(T3.name IS NULL, 'female', 'male') AS gender FROM enrolled AS T1 INNER JOIN person AS T2 ON T1.name = T2.name LEFT JOIN male AS T3 ON T2.name = T3.name WHERE T2.name = 'student34'
Database: student_loan
Tables: bool, person, disabled, enlist, filed_for_bankrupcy, longest_absense_from_school, male, no_payment_due, unemployed, enrolled
Columns (table index, column name): -1, *, 0, name, 1, name, 2, name, 3, name, 3, organ, 4, name, 5, name, 5, month, 6, name, 7, name, 7, bool, 8, name, 9, name, 9, school, 9, month
Question: List the longest duration of absense for a student enlisted in the fire department.
Evidence: longest duration of absence refers to MAX(month); department refers to organ; organ = 'fire_department';
SQL: SELECT T1.month FROM longest_absense_from_school AS T1 INNER JOIN enlist AS T2 ON T1.name = T2.name WHERE T2.organ = 'fire_department' ORDER BY T1.month DESC LIMIT 1