Chinastark/bird_dataset huggingface dataset:
Database: california_schools
Note: non-chartered schools refer to schools whose charter = 0; K-12 means grades 1 through 12; percent of eligible free rate for K-12 = `free meal count (k-12)` * 100 / `enrollment (k-12)`;
Question: What is the total number of non-chartered schools in the county of Los Angeles with a percent (%) of eligible free meals for grades 1 through 12 that is less than 0.18%?
SQL: SELECT count(schools.school) FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.county = 'Los Angeles' AND schools.charter = 0 AND cast(frpm.`free meal count (k-12)` AS REAL) * 100 / frpm.`enrollment (k-12)` < 0.18
Database: california_schools
Note: chartered schools refer to charter = 1 in the table schools; Full name refers to first name, last name;
Question: In chartered schools with charter number 00D2, what are the names of all the administrators? Include the name of the school and the city to which it belongs
SQL: SELECT admfname1, admlname1, school, city FROM schools WHERE charter = 1 AND charternum = '00D2'
Database: california_schools
Question: What is the total number of schools with a mailing city in Hickman belonging to the charter number 00D4?
SQL: SELECT count(*) FROM schools WHERE charternum = '00D4' AND mailcity = 'Hickman'
Database: california_schools
Note: Ratio in percentage = (count(locally funded schools in Santa Clara) / count(all funding type schools in Santa Clara) * 100%;
Question: What is the ratio in percentage of Santa Clara County schools that are locally funded compared to all other types of charter school funding?
SQL: SELECT cast(sum(CASE WHEN fundingtype = 'Locally funded' THEN 1 ELSE 0 END) AS REAL) * 100 / sum(CASE WHEN fundingtype != 'Locally funded' THEN 1 ELSE 0 END) FROM schools WHERE county = 'Santa Clara' AND charter = 1
Database: california_schools
Note: Directly funded schools refers to fundingtype = 'Directly Funded';
Question: Between 1/1/2000 to 12/31/2005, how many directly funded schools opened in the county of Stanislaus?
SQL: SELECT count(school) FROM schools WHERE strftime('%Y', opendate) BETWEEN '2000' AND '2005' AND county = 'Stanislaus' AND fundingtype = 'Directly funded'
Database: california_schools
Question: What is the total amount of Community College District closure in 1989 in the city of San Francisco?
SQL: SELECT count(school) FROM schools WHERE strftime('%Y', closeddate) = '1989' AND city = 'San Francisco' AND doctype = 'Community College District'
Database: california_schools
Note: Youth Authority Facilities (CEA) refers to soc = 11; 1980s = years between 1980 and 1989;
Question: Which county reported the most number of school closure in the 1980s with school wonership code belonging to Youth Authority Facilities (CEA)?
SQL: SELECT county FROM schools WHERE strftime('%Y', closeddate) BETWEEN '1980' AND '1989' AND statustype = 'Closed' AND soc = 11 GROUP BY county ORDER BY count(school) DESC LIMIT 1
Database: california_schools
Note: state Special schools means that soc = 31.;
Question: Please provide the National Center for Educational Statistics school district identification number for all schools with a School Ownership Code that are part of the State Special Schools.
SQL: SELECT ncesdist FROM schools WHERE soc = 31
Database: california_schools
Question: How many active and closed District Community Day Schools are there in the county of Alpine?
SQL: SELECT count(school) FROM schools WHERE (statustype = 'Closed' OR statustype = 'Active') AND soc = 69 AND county = 'Alpine'
Database: california_schools
Note: When magent is equal to 0 in the database, it means ths school doesn't offer a magnet program.;
Question: What is the district code for the School that does not offer a magnet program in the city of Fresno?
SQL: SELECT frpm.`district code` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.city = 'Fresno' AND schools.magnet = 0
Database: california_schools
Note: state Special school means edopscode = 'SSS';
Question: How many students from the ages of 5 to 17 are enrolled at the State Special School school in Fremont for the 2014-2015 academic year?
SQL: SELECT frpm.`enrollment (ages 5-17)` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.edopscode = 'SSS' AND schools.city = 'Fremont' AND frpm.`academic year` BETWEEN 2014 AND 2015
Database: california_schools
Question: What is the free or reduced price meal count for ages 5 to 17 in the Youth Authority School with a mailing street address of PO Box 1040?
SQL: SELECT frpm.`frpm count (ages 5-17)` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.mailstreet = 'PO Box 1040' AND schools.soctype = 'Youth Authority Facilities'
Database: california_schools
Note: district Special Education Consortia school refers to edopscode = 'SPECON'.;
Question: What is the lowest grade for the District Special Education Consortia School with National Center for Educational Statistics school district identification number of 0613360?
SQL: SELECT min(frpm.`low grade`) FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.ncesdist = '0613360' AND schools.edopscode = 'SPECON'
Database: california_schools
Question: What is the educational level name for the schools with Breakfast Provision 2 in county code 37? Indicate the name of the school.
SQL: SELECT schools.eilname, schools.school FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`nslp provision status` = 'Breakfast Provision 2' AND frpm.`county code` = 37
Database: california_schools
Note: High school can be represented as eilcode = 'HS';
Question: What is the city location of the high school level school with Lunch Provision 2 whose lowest grade is 9 and the highest grade is 12 in the county of Merced?
SQL: SELECT schools.city FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`nslp provision status` = 'Lunch Provision 2' AND schools.county = 'Merced' AND frpm.`low grade` = 9 AND frpm.`high grade` = 12 AND schools.eilcode = 'HS'
Database: california_schools
Note: percent (%) eligible frpm (ages 5-17) can be acquired by `frpm count (ages 5-17)` / `enrollment (ages 5-17)` * 100;
Question: Which schools served a grade span of Kindergarten to 9th grade in the county of Los Angeles and what is its Percent (%) Eligible FRPM (Ages 5-17)?
SQL: SELECT schools.school, frpm.`frpm count (ages 5-17)` * 100 / frpm.`enrollment (ages 5-17)` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.county = 'Los Angeles' AND schools.gsserved = 'K-9'
Database: california_schools
Question: What is the most common type of grade span served in the city of Adelanto?
SQL: SELECT gsserved FROM schools WHERE city = 'Adelanto' GROUP BY gsserved ORDER BY count(gsserved) DESC LIMIT 1
Database: california_schools
Note: 'Does not offer physical building' means virtual = F in the database.;
Question: Between San Diego and Santa Barbara, which county offers the most number of schools that does not offer physical building? Indicate the amount.
SQL: SELECT county, count(virtual) FROM schools WHERE (county = 'San Diego' OR county = 'Santa Barbara') AND virtual = 'F' GROUP BY county ORDER BY count(virtual) DESC LIMIT 1
Database: california_schools
Question: What is the school type of the school with the highest latitude? Indicate the name of the school as well as the latitude coordinates.
SQL: SELECT frpm.`school type`, frpm.`school name`, schools.latitude FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode ORDER BY schools.latitude DESC LIMIT 1
Database: california_schools
Note: state of California refers to state = 'CA';
Question: In which city can you find the school in the state of California with the lowest latitude coordinates and what is its lowest grade? Indicate the school name.
SQL: SELECT schools.city, frpm.`low grade`, frpm.`school name` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.state = 'CA' ORDER BY schools.latitude ASC LIMIT 1
Database: california_schools
Note: the highest longitude refers to the school with the maximum absolute longitude value.;
Question: What is the grade span offered in the school with the highest longitude?
SQL: SELECT gsoffered FROM schools ORDER BY abs(longitude) DESC LIMIT 1
Database: california_schools
Note: Kindergarten to 8th grade refers to K-8; 'Offers a magnet program' means magnet = 1; Multiple Provision Types refers to `nslp provision status` = 'Multiple Provision Types';
Question: Of the schools that offers a magnet program serving a grade span of Kindergarten to 8th grade, how many offers Multiple Provision Types? List the number of cities that offers a Kindergarten to 8th grade span and indicate how many schools are there serving such grade span for each city.
SQL: SELECT schools.city, count(schools.cdscode) FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.magnet = 1 AND schools.gsoffered = 'K-8' AND frpm.`nslp provision status` = 'Multiple Provision Types' GROUP BY schools.city
Database: california_schools
Question: What are the two most common first names among the school administrators? Indicate the district to which they administer.
SQL: SELECT DISTINCT schools.admfname1, schools.district FROM schools INNER JOIN ( SELECT admfname1 FROM schools GROUP BY admfname1 ORDER BY count(admfname1) DESC LIMIT 2 ) AS t2 ON schools.admfname1 = t2.admfname1
Database: california_schools
Note: percent (%) eligible free (k-12) = `free meal count (k-12)` / `enrollment (k-12)` * 100%;
Question: What is the Percent (%) Eligible Free (K-12) in the school administered by an administrator whose first name is Alusine. List the district code of the school.
SQL: SELECT frpm.`free meal count (k-12)` * 100 / frpm.`enrollment (k-12)`, frpm.`district code` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.admfname1 = 'Alusine'
Database: california_schools
Question: What is the administrator's last name that oversees the school with Charter number 40? Indicate the district, the county where the school is situated, and the name of the school.
SQL: SELECT admlname1, district, county, school FROM schools WHERE charternum = '0040'
Database: california_schools
Note: Intermediate/Middle schools refers to soc = 62; Unified school refers to doc = 54; years between 2009 and 2010 can refer to 'between 1/1/2009 to 12/31/2010';
Question: What are the valid e-mail addresses of the administrator of the school located in the San Bernardino county, City of San Bernardino City Unified that opened between 1/1/2009 to 12/31/2010 whose school types are public Intermediate/Middle Schools and Unified Schools?
SQL: SELECT schools.admemail1, schools.admemail2 FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.county = 'San Bernardino' AND schools.city = 'San Bernardino' AND schools.doc = 54 AND strftime('%Y', schools.opendate) BETWEEN '2009' AND '2010' AND schools.soc = 62
Database: california_schools
Question: What is the administrator's email address for the school with the highest number of test takers who received SAT scores of at least 1500?Provide the name of the school.
SQL: SELECT schools.admemail1, schools.school FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.numge1500 DESC LIMIT 1
Database: financial
Note: a3 contains the data of region; 'POPLATEK PO OBRATU' represents for 'issuance after transaction'.;
Question: How many accounts who choose issuance after transaction are staying in East Bohemia region?
SQL: SELECT count(account.account_id) FROM district INNER JOIN account ON district.district_id = account.district_id WHERE district.a3 = 'east Bohemia' AND account.frequency = 'POPLATEK PO OBRATU'
Database: financial
Note: a3 contains the data of region;
Question: How many accounts who have region in Prague are eligible for loans?
SQL: SELECT count(account.account_id) FROM account INNER JOIN loan ON account.account_id = loan.account_id INNER JOIN district ON account.district_id = district.district_id WHERE district.a3 = 'Prague'
Database: financial
Note: a12 refers to unemploymant rate 1995; a13 refers to unemploymant rate 1996;
Question: The average unemployment ratio of 1995 and 1996, which one has higher percentage?
SQL: SELECT DISTINCT iif(avg(a13) > avg(a12), '1996', '1995') FROM district
Database: financial
Note: a11 refers to average salary; Female mapps to gender = 'F';
Question: List out the no. of districts that have female average salary is more than 6000 but less than 10000?
SQL: SELECT count(DISTINCT district.district_id)  FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'F' AND district.a11 BETWEEN 6000 AND 10000
Database: financial
Note: Male means that gender = 'M'; a3 refers to region; a11 pertains to average salary.;
Question: How many male customers who are living in North Bohemia have average salary greater than 8000?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'M' AND district.a3 = 'north Bohemia' AND district.a11 > 8000
Database: financial
Note: Female means gender = 'F'; a11 refers to average salary; Gap = highest average salary - lowest average salary; If the person A's birthdate > B's birthdate, it means that person B is order than person A.;
Question: List out the account numbers of female clients who are oldest and has lowest average salary, calculate the gap between this lowest average salary with the highest average salary?
SQL: SELECT account.account_id , ( SELECT max(a11) - min(a11) FROM district ) FROM account INNER JOIN district ON account.district_id = district.district_id INNER JOIN disp ON account.account_id = disp.account_id INNER JOIN client ON disp.client_id = client.client_id WHERE district.district_id = ( SELECT district_id FROM client WHERE gender = 'F' ORDER BY birth_date ASC LIMIT 1 ) ORDER BY district.a11 DESC LIMIT 1
Database: financial
Note: If the person A's birthdate < B's birthdate, it means that person B is younger than person A; a11 refers to average salary;
Question: List out the account numbers of clients who are youngest and have highest average salary?
SQL: SELECT account.account_id  FROM account INNER JOIN disp ON account.account_id = disp.account_id INNER JOIN client ON disp.client_id = client.client_id INNER JOIN district ON district.district_id = account.district_id WHERE disp.client_id = ( SELECT client_id FROM client ORDER BY birth_date DESC LIMIT 1) GROUP BY district.a11, account.account_id
Database: financial
Note: 'POPLATEK TYDNE' stands for weekly issuance;
Question: How many customers who choose statement of weekly issuance are Owner?
SQL: SELECT count(account.account_id) FROM account INNER JOIN disp ON account.account_id = disp.account_id WHERE disp.type = 'OWNER' AND account.frequency = 'POPLATEK TYDNE'
Database: financial
Note: 'POPLATEK PO OBRATU' stands for issuance after transaction;
Question: List out the id number of client who choose statement of issuance after transaction are Disponent?
SQL: SELECT disp.client_id FROM account INNER JOIN disp ON account.account_id = disp.account_id WHERE account.frequency = 'POPLATEK PO OBRATU' AND disp.type = 'DISPONENT'
Database: financial
Note: 'POPLATEK TYDNE' stands for weekly issuance;
Question: Among the accounts who have approved loan date in 1997, list out the accounts that have the lowest approved amount and choose weekly issuance statement.
SQL: SELECT account.account_id FROM loan INNER JOIN account ON loan.account_id = account.account_id WHERE strftime('%Y', loan.date) = '1997' AND account.frequency = 'POPLATEK TYDNE' ORDER BY loan.amount LIMIT 1
Database: financial
Note: loan validity more than 12 months refers to duration > 12;
Question: Among the accounts who have loan validity more than 12 months, list out the accounts that have the highest approved amount and have account opening date in 1993.
SQL: SELECT loan.account_id FROM loan INNER JOIN account ON loan.account_id = account.account_id WHERE strftime('%Y', account.date) = '1993' AND loan.duration > 12 ORDER BY loan.amount DESC LIMIT 1
Database: financial
Note: Customers refer to clients; Female refers to gender = 'F'; Names of districts appear in column a2;
Question: Among the account opened, how many female customers who were born before 1950 and stayed in Sokolov?
SQL: SELECT count(client.client_id) FROM district INNER JOIN client ON district.district_id = client.district_id WHERE client.gender = 'F' AND strftime('%Y', client.birth_date) < '1950' AND district.a2 = 'Sokolov'
Database: financial
Question: List out the accounts who have the earliest trading date in 1995 ?
SQL: SELECT account_id FROM trans WHERE strftime('%Y', date) = '1995' ORDER BY date ASC LIMIT 1
Database: financial
Question: State different accounts who have account opening date before 1997 and own an amount of money greater than 3000USD
SQL: SELECT DISTINCT account.account_id FROM trans INNER JOIN account ON trans.account_id = account.account_id WHERE strftime('%Y', account.date) < '1997' AND trans.amount > 3000
Database: financial
Question: Which client issued his/her card in 1994/3/3, give his/her client id.
SQL: SELECT disp.client_id FROM client INNER JOIN disp ON client.client_id = disp.client_id INNER JOIN card ON disp.disp_id = card.disp_id WHERE card.issued = '1994-03-03'
Database: financial
Question: The transaction of 840 USD happened in 1998/10/14, when was this account opened?
SQL: SELECT account.date FROM account INNER JOIN trans ON account.account_id = trans.account_id WHERE trans.amount = 840 AND trans.date = '1998-10-14'
Database: financial
Question: There was a loan approved in 1994/8/25, where was that account opened, give the district Id of the branch.
SQL: SELECT account.district_id FROM account INNER JOIN loan ON account.account_id = loan.account_id WHERE loan.date = '1994-08-25'
Database: financial
Question: What is the biggest amount of transaction that the client whose card was opened in 1996/10/21 made?
SQL: SELECT trans.amount FROM card JOIN disp ON card.disp_id = disp.disp_id JOIN account ON disp.account_id = account.account_id JOIN trans ON account.account_id = trans.account_id WHERE card.issued = '1996-10-21' ORDER BY trans.amount DESC LIMIT 1
Database: financial
Note: Earlier birthdate refers to older age; a11 refers to average salary;
Question: What is the gender of the oldest client who opened his/her account in the highest average salary branch?
SQL: SELECT client.gender FROM district INNER JOIN client ON district.district_id = client.district_id ORDER BY district.a11 DESC, client.birth_date ASC LIMIT 1
Database: financial
Question: For the client who applied the biggest loan, what was his/her first amount of transaction after opened the account?
SQL: SELECT trans.amount FROM loan INNER JOIN account ON loan.account_id = account.account_id INNER JOIN trans ON account.account_id = trans.account_id ORDER BY loan.amount DESC, trans.date ASC LIMIT 1
Database: financial
Note: a2 has region names; Woman and female share the same meaning; female refers to gender = 'F';
Question: How many clients opened their accounts in Jesenik branch were women?
SQL: SELECT count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE client.gender = 'F' AND district.a2 = 'Jesenik'
Database: financial
Question: What is the disposition id of the client who made 5100 USD transaction in 1998/9/2?
SQL: SELECT disp.disp_id FROM disp INNER JOIN account ON disp.account_id = account.account_id INNER JOIN trans ON account.account_id = trans.account_id WHERE trans.date='1997-08-20' AND trans.amount = 5100
Database: financial
Note: a2 refers to district name; Litomerice is one of district names.;
Question: How many accounts were opened in Litomerice in 1996?
SQL: SELECT count(account.account_id) FROM district INNER JOIN account ON district.district_id = account.district_id WHERE strftime('%Y', account.date) = '1996' AND district.a2 = 'Litomerice'
Database: financial
Note: Female refers to gender = 'F'; a2 refers to district names;
Question: For the female client who was born in 1976/1/29, which district did she opened her account?
SQL: SELECT district.a2 FROM district INNER JOIN client ON district.district_id = client.district_id WHERE client.birth_date = '1976-01-29' AND client.gender = 'F'
Database: financial
Question: For the client who applied 98832 USD loan in 1996/1/3, when was his/her birthday?
SQL: SELECT client.birth_date FROM loan INNER JOIN account ON loan.account_id = account.account_id INNER JOIN disp ON account.account_id = disp.account_id INNER JOIN client ON disp.client_id = client.client_id WHERE loan.date = '1996-01-03' AND loan.amount = 98832
Database: financial
Note: a3 stands for region names;
Question: For the first client who opened his/her account in Prague, what is his/her account ID?
SQL: SELECT account.account_id FROM account INNER JOIN district ON account.district_id = district.district_id WHERE district.a3 = 'Prague' ORDER BY account.date ASC LIMIT 1
Database: financial
Note: Percentage of the male clients = DIVIDE(COUNT(male clients), COUNT(clients)) * 100; Male refers to gender = 'M', a3 is the region name. a4 contains the information about inhabitants.;
Question: For the branch which located in the south Bohemia with biggest number of inhabitants, what is the percentage of the male clients?
SQL: SELECT cast(sum(client.gender = 'M') AS REAL) * 100 / count(client.client_id) FROM client INNER JOIN district ON client.district_id = district.district_id WHERE district.a3 = 'south Bohemia' GROUP BY district.a4 ORDER BY district.a4 DESC LIMIT 1
Database: financial
Note: Increase rate of his/her account balance = [(balance of date A - balance of date B) / balance of date B] * 100%;
Question: For the client whose loan was approved first in 1993/7/5, what is the increase rate of his/her account balance from 1993/3/22 to 1998/12/27?
SQL: SELECT cast((sum(iif(trans.date = '1998-12-27', trans.balance, 0)) - sum(iif(trans.date = '1993-03-22', trans.balance, 0))) AS REAL) * 100 / sum(iif(trans.date = '1993-03-22', trans.balance, 0)) FROM loan INNER JOIN account ON loan.account_id = account.account_id INNER JOIN trans ON trans.account_id = account.account_id WHERE loan.date = '1993-07-05'
Database: financial
Note: loan paid with no issue means contract finished, no problems; status = 'A' means contract finished, no problems; Percentage of accounts by condition = [(total(amount) & condition) / (total amount)] * 100%;
Question: What is the percentage of loan amount that has been fully paid with no issue.
SQL: SELECT (cast(sum(CASE WHEN status = 'A' THEN amount ELSE 0 END) AS REAL) * 100) / sum(amount) FROM loan
Database: financial
Note: status = 'C' stands for running contract, ok so far; Percentage of accounts by condition = [(total(amount) & condition) / (total amount)] * 100.;
Question: For loan amount less than USD100,000, what is the percentage of accounts that is still running with no issue.
SQL: SELECT cast(sum(status = 'C') AS REAL) * 100 / count(account_id) FROM loan WHERE amount < 100000
Database: financial
Note: Records about district names could be found in a2; a3 contains the information about regions. 'POPLATEK PO OBRATU' stands for issuance after transaction;
Question: For accounts in 1993 with statement issued after transaction, list the account ID, district name and district region.
SQL: SELECT account.account_id, district.a2, district.a3 FROM account INNER JOIN district ON account.district_id = district.district_id WHERE account.frequency = 'POPLATEK PO OBRATU' AND strftime('%Y', account.date)= '1993'
Database: financial
Note: accounts holder refers to the person who own this account.;
Question: From Year 1995 to 2000, who are the accounts holders from 'east Bohemia'. State the account ID the frequency of statement issuance.
SQL: SELECT account.account_id, account.frequency FROM account INNER JOIN district ON account.district_id = district.district_id WHERE district.a3 = 'east Bohemia' AND strftime('%Y', account.date) BETWEEN '1995' AND '2000'