Chinastark/bird_dataset huggingface dataset:
Database: california_schools
Note: Eligible free rate for K-12 = `free meal count (k-12)` / `enrollment (k-12)`;
Question: What is the highest eligible free rate for K-12 students in the schools in Alameda County?
SQL: SELECT `free meal count (k-12)` / `enrollment (k-12)` FROM frpm WHERE `county name` = 'Alameda' ORDER BY (cast(`free meal count (k-12)` AS REAL) / `enrollment (k-12)`) DESC LIMIT 1
Database: california_schools
Note: Eligible free rates for students aged 5-17 = `free meal count (ages 5-17)` / `enrollment (ages 5-17)`;
Question: Please list the lowest three eligible free rates for students aged 5-17 in continuation schools.
SQL: SELECT `free meal count (ages 5-17)` / `enrollment (ages 5-17)` FROM frpm WHERE `educational option type` = 'Continuation School' AND `free meal count (ages 5-17)` / `enrollment (ages 5-17)` IS NOT NULL ORDER BY `free meal count (ages 5-17)` / `enrollment (ages 5-17)` ASC LIMIT 3
Database: california_schools
Note: charter schools refers to `charter school (y/n)` = 1 in the table fprm;
Question: Please list the zip code of all the charter schools in Fresno County Office of Education.
SQL: SELECT schools.zip FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`district name` = 'Fresno County Office of Education' AND frpm.`charter school (y/n)` = 1
Database: california_schools
Question: What is the unabbreviated mailing street address of the school with the highest FRPM count for K-12 students?
SQL: SELECT schools.mailstreet FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode ORDER BY frpm.`frpm count (k-12)` DESC LIMIT 1
Database: california_schools
Note: charter schools refers to `charter school (y/n)` = 1 in the frpm;
Question: Please list the phone numbers of the direct charter-funded schools that are opened after 2000/1/1.
SQL: SELECT schools.phone FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`charter funding type` = 'Directly funded' AND frpm.`charter school (y/n)` = 1 AND schools.opendate > '2000-01-01'
Database: california_schools
Note: Exclusively virtual refers to virtual = 'F';
Question: How many schools with an average score in Math greater than 400 in the SAT test are exclusively virtual?
SQL: SELECT count(DISTINCT schools.school) FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.virtual = 'F' AND satscores.avgscrmath > 400
Database: california_schools
Note: magnet schools or offer a magnet program means that magnet = 1;
Question: Among the schools with the SAT test takers of over 500, please list the schools that are magnet schools or offer a magnet program.
SQL: SELECT schools.school FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.magnet = 1 AND satscores.numtsttakr > 500
Database: california_schools
Question: What is the phone number of the school that has the highest number of test takers with an SAT score of over 1500?
SQL: SELECT schools.phone FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.numge1500 DESC LIMIT 1
Database: california_schools
Question: What is the number of SAT test takers of the schools with the highest FRPM count for K-12 students?
SQL: SELECT numtsttakr FROM satscores WHERE cds = ( SELECT cdscode FROM frpm ORDER BY `frpm count (k-12)` DESC LIMIT 1 )
Database: california_schools
Question: Among the schools with the average score in Math over 560 in the SAT test, how many schools are directly charter-funded?
SQL: SELECT count(frpm.`school code`) FROM satscores INNER JOIN frpm ON satscores.cds = frpm.cdscode WHERE satscores.avgscrmath > 560 AND frpm.`charter funding type` = 'Directly funded'
Database: california_schools
Question: For the school with the highest average score in Reading in the SAT test, what is its FRPM count for students aged 5-17?
SQL: SELECT frpm.`frpm count (ages 5-17)` FROM satscores INNER JOIN frpm ON satscores.cds = frpm.cdscode ORDER BY satscores.avgscrread DESC LIMIT 1
Database: california_schools
Note: Total enrollment can be represented by `enrollment (k-12)` + `enrollment (ages 5-17)`;
Question: Please list the codes of the schools with a total enrollment of over 500.
SQL: SELECT frpm.cdscode FROM schools INNER JOIN frpm ON schools.cdscode = frpm.cdscode WHERE frpm.`enrollment (k-12)` + frpm.`enrollment (ages 5-17)` > 500
Database: california_schools
Note: Excellence rate = numge1500 / numtsttakr; Eligible free rates for students aged 5-17 = `free meal count (ages 5-17)` / `enrollment (ages 5-17)`;
Question: Among the schools with an SAT excellence rate of over 0.3, what is the highest eligible free rate for students aged 5-17?
SQL: SELECT max(cast(frpm.`free meal count (ages 5-17)` AS REAL) / frpm.`enrollment (ages 5-17)`) FROM frpm INNER JOIN satscores ON frpm.cdscode = satscores.cds WHERE cast(satscores.numge1500 AS REAL) / satscores.numtsttakr > 0.3
Database: california_schools
Note: Excellence rate = numge1500 / numtsttakr;
Question: Please list the phone numbers of the schools with the top 3 SAT excellence rate.
SQL: SELECT schools.phone FROM schools INNER JOIN satscores ON schools.cdscode = satscores.cds ORDER BY cast(satscores.numge1500 AS REAL) / satscores.numtsttakr DESC LIMIT 3
Database: california_schools
Question: List the top five schools, by descending order, from the highest to the lowest, the most number of Enrollment (Ages 5-17). Please give their NCES school identification number.
SQL: SELECT schools.ncesschool FROM schools INNER JOIN frpm ON schools.cdscode = frpm.cdscode ORDER BY frpm.`enrollment (ages 5-17)` DESC LIMIT 5
Database: california_schools
Question: Which active district has the highest average score in Reading?
SQL: SELECT schools.district FROM schools INNER JOIN satscores ON schools.cdscode = satscores.cds WHERE schools.statustype = 'Active' ORDER BY satscores.avgscrread DESC LIMIT 1
Database: california_schools
Question: How many schools in merged Alameda have number of test takers less than 100?
SQL: SELECT count(schools.cdscode) FROM schools INNER JOIN satscores ON schools.cdscode = satscores.cds WHERE schools.statustype = 'Merged' AND satscores.numtsttakr < 100 AND schools.county = 'Lake'
Database: california_schools
Note: Valid charter number means the number is not null;
Question: Rank schools by their average score in Writing where the score is greater than 499, showing their charter numbers.
SQL: SELECT charternum, avgscrwrite, rank() OVER (ORDER BY avgscrwrite DESC) AS writingscorerank FROM schools  INNER JOIN satscores ON schools.cdscode = satscores.cds WHERE satscores.avgscrwrite > 499 AND charternum IS NOT NULL
Database: california_schools
Question: How many schools in Fresno (directly funded) have number of test takers not more than 250?
SQL: SELECT count(frpm.cdscode) FROM frpm INNER JOIN satscores ON frpm.cdscode = satscores.cds WHERE frpm.`charter funding type` = 'Directly funded' AND frpm.`county name` = 'Fresno' AND satscores.numtsttakr <= 250
Database: california_schools
Question: What is the phone number of the school that has the highest average score in Math?
SQL: SELECT schools.phone FROM schools INNER JOIN satscores ON schools.cdscode = satscores.cds ORDER BY satscores.avgscrmath DESC LIMIT 1
Database: california_schools
Question: How many schools in Amador which the Low Grade is 9 and the High Grade is 12?
SQL: SELECT count(frpm.`school name`) FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.county = 'Amador' AND frpm.`low grade` = 9 AND frpm.`high grade` = 12
Database: california_schools
Question: In Los Angeles how many schools have more than 500 free meals but less than 700 free or reduced price meals for K-12?
SQL: SELECT count(cdscode) FROM frpm WHERE `county name` = 'Los Angeles' AND `free meal count (k-12)` > 500 AND `frpm count (k-12)`< 700
Database: california_schools
Question: Which school in Contra Costa has the highest number of test takers?
SQL: SELECT sname FROM satscores WHERE cname = 'Contra Costa' AND sname IS NOT NULL ORDER BY numtsttakr DESC LIMIT 1
Database: california_schools
Note: Diffrence in enrollement = `enrollment (k-12)` - `enrollment (ages 5-17)`;
Question: List the names of schools with more than 30 difference in enrollements between K-12 and ages 5-17? Please also give the full street adress of the schools.
SQL: SELECT schools.school, schools.street FROM schools INNER JOIN frpm ON schools.cdscode = frpm.cdscode WHERE frpm.`enrollment (k-12)` - frpm.`enrollment (ages 5-17)` > 30
Database: california_schools
Note: Percent eligible for free meals = free meal count (k-12) / Total (enrollment (k-12);
Question: Give the names of the schools with the percent eligible for free meals in K-12 is more than 0.1 and test takers whose test score is greater than or equal to 1500?
SQL: SELECT frpm.`school name` FROM satscores INNER JOIN frpm ON satscores.cds = frpm.cdscode WHERE cast(frpm.`free meal count (k-12)` AS REAL) / frpm.`enrollment (k-12)` > 0.1 AND satscores.numge1500 > 0
Database: california_schools
Note: Average of average math = sum(average math scores) / count(schools).;
Question: Name schools in Riverside which the average of average math score for SAT is grater than 400, what is the funding type of these schools?
SQL: SELECT satscores.sname, frpm.`charter funding type` FROM satscores INNER JOIN frpm ON satscores.cds = frpm.cdscode WHERE frpm.`district name` LIKE 'Riverside%' GROUP BY satscores.sname, frpm.`charter funding type` HAVING cast(sum(satscores.avgscrmath) AS REAL) / count(satscores.cds) > 400
Database: california_schools
Note: Full communication address should include street, city, state and zip code if any.;
Question: State the names and full communication address of high schools in Monterey which has more than 800 free or reduced price meals for ages 15-17?
SQL: SELECT frpm.`school name`, schools.street, schools.city, schools.state, schools.zip FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.county = 'Monterey' AND frpm.`free meal count (ages 5-17)` > 800 AND frpm.`school type` = 'High Schools (Public)'
Database: california_schools
Note: Communication number refers to phone number.;
Question: What is the average score in writing for the schools that were opened after 1991 or closed before 2000? List the school names along with the score. Also, list the communication number of the schools if there is any.
SQL: SELECT schools.school, satscores.avgscrwrite, schools.phone FROM schools LEFT JOIN satscores ON schools.cdscode = satscores.cds WHERE strftime('%Y', schools.opendate) > '1991' OR strftime('%Y', schools.closeddate) < '2000'
Database: california_schools
Note: Difference between K-12 enrollment and 15-17 enrollment can be computed by `enrollment (k-12)` - `enrollment (ages 5-17)`;
Question: Consider the average difference between K-12 enrollment and 15-17 enrollment of schools that are locally funded, list the names and DOC type of schools which has a difference above this average.
SQL: SELECT schools.school, schools.doc FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.fundingtype = 'Locally funded' AND (frpm.`enrollment (k-12)` - frpm.`enrollment (ages 5-17)`) > (SELECT avg(frpm.`enrollment (k-12)` - frpm.`enrollment (ages 5-17)`) FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.fundingtype = 'Locally funded')
Database: california_schools
Note: K-12 means First-through-twelfth-grade;
Question: When did the first-through-twelfth-grade school with the largest enrollment open?
SQL: SELECT schools.opendate FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode ORDER BY frpm.`enrollment (k-12)` DESC LIMIT 1
Database: california_schools
Note: K-12 refers to students in grades 1 through 12.;
Question: Which cities have the top 5 lowest enrollment number for students in grades 1 through 12?
SQL: SELECT schools.city FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode GROUP BY schools.city ORDER BY sum(frpm.`enrollment (k-12)`) ASC LIMIT 5
Database: california_schools
Note: K-12 refers to students in grades 1 through 12; Eligible free rate for K-12 = `free meal count (k-12)` / `enrollment (k-12)`;
Question: What is the eligible free rate of the 10th and 11th schools with the highest enrolment for students in grades 1 through 12?
SQL: SELECT cast(`free meal count (k-12)` AS REAL) / `enrollment (k-12)` FROM frpm ORDER BY `enrollment (k-12)` DESC LIMIT 9, 2
Database: california_schools
Note: grades 1-12 means K-12; Eligible free or reduced price meal rate for K-12 = `frpm count (k-12)` / `enrollment (k-12)`;
Question: What is the eligible free or reduced price meal rate for the top 5 schools in grades 1-12 with the highest free or reduced price meal count of the schools with the ownership code 66?
SQL: SELECT cast(frpm.`frpm count (k-12)` AS REAL) / frpm.`enrollment (k-12)` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.soc = 66 ORDER BY frpm.`frpm count (k-12)` DESC LIMIT 5
Database: california_schools
Question: If there are any, what are the websites address of the schools with a free meal count of 1,900-2,000 to students aged 5-17? Include the name of the school.
SQL: SELECT schools.website, frpm.`school name` FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`free meal count (ages 5-17)` BETWEEN 1900 AND 2000 AND schools.website IS NOT NULL
Database: california_schools
Note: Eligible free rates for students aged 5-17 = `free meal count (ages 5-17)` / `enrollment (ages 5-17)`;
Question: What is the free rate for students between the ages of 5 and 17 at the school run by Kacey Gibson?
SQL: SELECT cast(frpm.`free meal count (ages 5-17)` AS REAL) / frpm.`enrollment (ages 5-17)` FROM schools INNER JOIN frpm ON schools.cdscode = frpm.cdscode WHERE schools.admfname1 = 'Kacey' AND schools.admlname1 = 'Gibson'
Database: california_schools
Note: Charted school means `charter school (y/n)` = 1 in the table frpm; Students enrolled in grades 1 through 12 refers to `enrollment (k-12)`;
Question: What is the administrator's email address of the chartered school with the fewest students enrolled in grades 1 through 12?
SQL: SELECT schools.admemail1 FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE frpm.`charter school (y/n)` = 1 ORDER BY frpm.`enrollment (k-12)` ASC LIMIT 1
Database: california_schools
Note: full name means first name, last name; There are at most 3 administrators for each school; SAT Scores are greater or equal to 1500 refers to numge1500;
Question: Under whose administration is the school with the highest number of students scoring 1500 or more on the SAT? Indicate their full names.
SQL: SELECT schools.admfname1, schools.admlname1, schools.admfname2, schools.admlname2, schools.admfname3, schools.admlname3 FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.numge1500 DESC LIMIT 1
Database: california_schools
Note: Execellence Rate = numge1500 / numtsttakr; complete address has street, city, state, zip code;
Question: What is the complete address of the school with the lowest excellence rate? Indicate the Street, City, Zip and State.
SQL: SELECT schools.street, schools.city, schools.state, schools.zip FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY cast(satscores.numge1500 AS REAL) / satscores.numtsttakr ASC LIMIT 1
Database: california_schools
Question: What are the webpages for the Los Angeles County school that has between 2,000 and 3,000 test takers?
SQL: SELECT schools.website FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE satscores.numtsttakr BETWEEN 2000 AND 3000 AND schools.county = 'Los Angeles'
Database: california_schools
Note: between 1/1/1980 and 12/31/1980 means the year = 1980;
Question: What is the average number of test takers from Fresno schools that opened between 1/1/1980 and 12/31/1980?
SQL: SELECT avg(satscores.numtsttakr) FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE strftime('%Y', schools.opendate) = '1980' AND schools.county = 'Fresno'
Database: california_schools
Note: Fresno Unified is a name of district;
Question: What is the telephone number for the school with the lowest average score in reading in Fresno Unified?
SQL: SELECT schools.phone FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.district = 'Fresno Unified' AND satscores.avgscrread IS NOT NULL ORDER BY satscores.avgscrread ASC LIMIT 1
Database: california_schools
Note: Exclusively virtual refers to virtual = 'F'; respective counties means PARTITION BY county;
Question: List the names of virtual schools that are among the top 5 in their respective counties based on average reading scores.
SQL: SELECT school FROM (SELECT schools.school,satscores.avgscrread, rank() OVER (PARTITION BY schools.county ORDER BY satscores.avgscrread DESC) AS rnk FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.virtual = 'F' ) ranked_schools WHERE rnk <= 5
Database: california_schools
Question: What is the type of education offered in the school who scored the highest average in Math?
SQL: SELECT schools.edopsname FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.avgscrmath DESC LIMIT 1
Database: california_schools
Note: Average score for all subjects can be computed by avgscrmath + avgscrread + avgscrwrite;
Question: What is the average math score of the school with the lowest average score for all subjects, and in which county is it located?
SQL: SELECT satscores.avgscrmath, schools.county FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE satscores.avgscrmath IS NOT NULL ORDER BY satscores.avgscrmath + satscores.avgscrread + satscores.avgscrwrite ASC LIMIT 1
Database: california_schools
Question: What is the average writing score of the school who has the highest number of test takers whose total SAT sscores are greater or equal to 1500? Indicate the city to where the school is situated.
SQL: SELECT satscores.avgscrwrite, schools.city FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.numge1500 DESC LIMIT 1
Database: california_schools
Note: Usually, administrators manage the school stuff.;
Question: What is the average writing score of each of the schools managed by Ricci Ulrich? List the schools and the corresponding average writing scores.
SQL: SELECT schools.school, satscores.avgscrwrite FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.admfname1 = 'Ricci' AND schools.admlname1 = 'Ulrich'
Database: california_schools
Note: state Special schools refers to doc = 31; Grades 1 through 12 means K-12;
Question: Which state special schools have the highest number of enrollees from grades 1 through 12?
SQL: SELECT schools.school FROM frpm INNER JOIN schools ON frpm.cdscode = schools.cdscode WHERE schools.doc = 31 ORDER BY frpm.`enrollment (k-12)` DESC LIMIT 1
Database: california_schools
Note: Elementary school district refers to doc = 52; Monthly average number of schools that opened in 1980 = count(schools that opened in 1980) / 12;
Question: What is the monthly average number of schools that opened in Alameda County under the jurisdiction of the Elementary School District in 1980?
SQL: SELECT cast(count(school) AS REAL) / 12 FROM schools WHERE doc = 52 AND county = 'Alameda' AND strftime('%Y', opendate) = '1980'
Database: california_schools
Note: Elementary school district refers to doc = 52; Unified school district refers to doc = 54.;
Question: What is the ratio of merged Unified School District schools in Orange County to merged Elementary School District schools?
SQL: SELECT cast(sum(CASE WHEN doc = 54 THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN doc = 52 THEN 1 ELSE 0 END) FROM schools WHERE statustype = 'Merged' AND county = 'Orange'
Database: california_schools
Note: Closure date and closed date are synonyms; 'Closed' was mentioned in schools.statustype.;
Question: Which different county has the most number of closed schools? Please provide the name of each school as well as the closure date.
SQL: SELECT DISTINCT county, school, closeddate FROM schools WHERE county = ( SELECT county FROM schools WHERE statustype = 'Closed' GROUP BY county ORDER BY count(school) DESC LIMIT 1 ) AND statustype = 'Closed' AND school IS NOT NULL
Database: california_schools
Note: Postal street and mailing street are synonyms.;
Question: What is the postal street address for the school with the 7th highest Math average? Indicate the school's name.
SQL: SELECT schools.mailstreet, schools.school FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.avgscrmath DESC LIMIT 6, 1
Database: california_schools
Question: In which mailing street address can you find the school that has the lowest average score in reading? Also give the school's name.
SQL: SELECT schools.mailstreet, schools.school FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE satscores.avgscrread IS NOT NULL ORDER BY satscores.avgscrread ASC LIMIT 1
Database: california_schools
Note: Total SAT scores can be computed by avgscrread + avgscrmath + avgscrwrite;
Question: What is the total number of schools whose total SAT scores are greater or equal to 1500 whose mailing city is Lakeport?
SQL: SELECT count(satscores.cds) FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.mailcity = 'Lakeport' AND (satscores.avgscrread + satscores.avgscrmath + satscores.avgscrwrite) >= 1500
Database: california_schools
Question: How many test takers are there at the school/s whose mailing city address is in Fresno?
SQL: SELECT satscores.numtsttakr FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode WHERE schools.mailcity = 'Fresno'
Database: california_schools
Question: Please specify all of the schools and their related mailing zip codes that are under Avetik Atoian's administration.
SQL: SELECT school, mailzip FROM schools WHERE admfname1 = 'Avetik' AND admlname1 = 'Atoian'
Database: california_schools
Note: Ratio = count(schools in Colusa) / count(schools in Humboldt);
Question: Of the schools with a mailing state address in California, what is the ratio of the schools located in the county of Colusa against the school located in the county of Humboldt?
SQL: SELECT cast(sum(CASE WHEN county = 'Colusa' THEN 1 ELSE 0 END) AS REAL) / sum(CASE WHEN county = 'Humboldt' THEN 1 ELSE 0 END) FROM schools WHERE mailstate = 'CA'
Database: california_schools
Question: Of all the schools with a mailing state address in California, how many are active in San Joaquin city?
SQL: SELECT count(cdscode) FROM schools WHERE city = 'San Joaquin' AND mailstate = 'CA' AND statustype = 'Active'
Database: california_schools
Question: What is the phone number and extension number for the school that had the 333rd highest average writing score?
SQL: SELECT schools.phone, schools.ext FROM satscores INNER JOIN schools ON satscores.cds = schools.cdscode ORDER BY satscores.avgscrwrite DESC LIMIT 332, 1
Database: california_schools
Question: What is the phone number and extension number for the school with the zip code 95203-3704? Indicate the school's name.
SQL: SELECT phone, ext, school FROM schools WHERE zip = '95203-3704'
Database: california_schools
Question: What is the website for the schools under the administrations of Mike Larson and Dante Alvarez?
SQL: SELECT website FROM schools WHERE (admfname1 = 'Mike' AND admlname1 = 'Larson') OR (admfname1 = 'Dante' AND admlname1 = 'Alvarez')
Database: california_schools
Note: virtual = 'P' means partially virtual; charter schools refers to charter = 1 in the table schools;
Question: What are the websites for all the partially virtual chartered schools located in San Joaquin?
SQL: SELECT website FROM schools WHERE county = 'San Joaquin' AND virtual = 'P' AND charter = 1
Database: california_schools
Note: Elementary school district refers to doc = 52; chartered schools refer to charter = 1 in the table schools;
Question: How many chartered schools located in the city of Hickman are owned by the Elementary School District?
SQL: SELECT count(school) FROM schools WHERE doc = 52 AND charter = 1 AND city = 'Hickman'