Dataset Preview
The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code:   DatasetGenerationCastError
Exception:    DatasetGenerationCastError
Message:      An error occurred while generating the dataset

All the data files must have the same columns, but at some point there are 1 new columns ({'external_knowledge'}) and 1 missing columns ({'evidence'}).

This happened while the json dataset builder was generating data using

hf://datasets/NovaSky-AI/SkyRL-SQL-eval/dev_spider.json (at revision 43ce876f1f241a2e3436eabe40a1cc2a10b8fb25)

Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback:    Traceback (most recent call last):
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1871, in _prepare_split_single
                  writer.write_table(table)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/arrow_writer.py", line 643, in write_table
                  pa_table = table_cast(pa_table, self._schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2293, in table_cast
                  return cast_table_to_schema(table, schema)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/table.py", line 2241, in cast_table_to_schema
                  raise CastError(
              datasets.table.CastError: Couldn't cast
              question: string
              schema: string
              input_seq: string
              output_seq: string
              external_knowledge: string
              -- schema metadata --
              pandas: '{"index_columns": [], "column_indexes": [], "columns": [{"name":' + 722
              to
              {'question': Value(dtype='string', id=None), 'schema': Value(dtype='string', id=None), 'input_seq': Value(dtype='string', id=None), 'output_seq': Value(dtype='string', id=None), 'evidence': Value(dtype='string', id=None)}
              because column names don't match
              
              During handling of the above exception, another exception occurred:
              
              Traceback (most recent call last):
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1433, in compute_config_parquet_and_info_response
                  parquet_operations = convert_to_parquet(builder)
                File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1050, in convert_to_parquet
                  builder.download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 925, in download_and_prepare
                  self._download_and_prepare(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1001, in _download_and_prepare
                  self._prepare_split(split_generator, **prepare_split_kwargs)
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1742, in _prepare_split
                  for job_id, done, content in self._prepare_split_single(
                File "/src/services/worker/.venv/lib/python3.9/site-packages/datasets/builder.py", line 1873, in _prepare_split_single
                  raise DatasetGenerationCastError.from_cast_error(
              datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
              
              All the data files must have the same columns, but at some point there are 1 new columns ({'external_knowledge'}) and 1 missing columns ({'evidence'}).
              
              This happened while the json dataset builder was generating data using
              
              hf://datasets/NovaSky-AI/SkyRL-SQL-eval/dev_spider.json (at revision 43ce876f1f241a2e3436eabe40a1cc2a10b8fb25)
              
              Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)

Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.

question
string
schema
string
input_seq
string
output_seq
string
evidence
string
What is the highest eligible free rate for K-12 students in the schools in Alameda County?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Alameda', 'Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Alameda', 'Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Free', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Alameda', 'Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Alameda', 'Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Free', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Eligible free rate for K-12 = `Free Meal Count (K-12)` / `Enrollment (K-12)` What is the highest eligible free rate for K-12 students in the schools in Alameda County? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
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
Eligible free rate for K-12 = `Free Meal Count (K-12)` / `Enrollment (K-12)`
Please list the lowest three eligible free rates for students aged 5-17 in continuation schools.
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Continuation School', 'Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['Continuation School', 'FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Continuation School', 'Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Free', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Continuation School', 'Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['Continuation School', 'FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Continuation School', 'Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Free', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Eligible free rates for students aged 5-17 = `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)` Please list the lowest three eligible free rates for students aged 5-17 in continuation schools. Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
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
Eligible free rates for students aged 5-17 = `Free Meal Count (Ages 5-17)` / `Enrollment (Ages 5-17)`
Please list the zip code of all the charter schools in Fresno County Office of Education.
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Fresno', 'Alameda', 'Alpine'] `District Name` text, -- example: ['Fresno County Office of Education', 'Inyo County Office of Education', 'Lake County Office of Education', 'Kern County Office of Education', 'Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Fresno County Office of Education', 'Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Fresno', 'Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Fresno', 'Alameda', 'Alpine'] District text, -- example: ['Fresno County Office of Education', 'Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Fresno', 'Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Fresno', 'Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Fresno', 'Alameda', 'Alpine'] `District Name` text, -- example: ['Fresno County Office of Education', 'Inyo County Office of Education', 'Lake County Office of Education', 'Kern County Office of Education', 'Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Fresno County Office of Education', 'Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Fresno', 'Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Fresno', 'Alameda', 'Alpine'] District text, -- example: ['Fresno County Office of Education', 'Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Fresno', 'Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Fresno', 'Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Charter schools refers to `Charter School (Y/N)` = 1 in the table fprm Please list the zip code of all the charter schools in Fresno County Office of Education. Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.Zip FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode WHERE T1.`District Name` = 'Fresno County Office of Education' AND T1.`Charter School (Y/N)` = 1
Charter schools refers to `Charter School (Y/N)` = 1 in the table fprm
What is the unabbreviated mailing street address of the school with the highest FRPM count for K-12 students?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: What is the unabbreviated mailing street address of the school with the highest FRPM count for K-12 students? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.MailStreet FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode ORDER BY T1.`FRPM Count (K-12)` DESC LIMIT 1
None
Please list the phone numbers of the direct charter-funded schools that are opened after 2000/1/1.
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Charter schools refers to `Charter School (Y/N)` = 1 in the frpm Please list the phone numbers of the direct charter-funded schools that are opened after 2000/1/1. Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.Phone FROM frpm AS T1 INNER JOIN schools AS T2 ON T1.CDSCode = T2.CDSCode WHERE T1.`Charter Funding Type` = 'Directly funded' AND T1.`Charter School (Y/N)` = 1 AND T2.OpenDate > '2000-01-01'
Charter schools refers to `Charter School (Y/N)` = 1 in the frpm
How many schools with an average score in Math greater than 400 in the SAT test are exclusively virtual?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['F', 'P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['F', 'P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Exclusively virtual refers to Virtual = 'F' How many schools with an average score in Math greater than 400 in the SAT test are exclusively virtual? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT COUNT(DISTINCT T2.School) FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.Virtual = 'F' AND T1.AvgScrMath > 400
Exclusively virtual refers to Virtual = 'F'
Among the schools with the SAT test takers of over 500, please list the schools that are magnet schools or offer a magnet program.
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Means', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Means', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Magnet schools or offer a magnet program means that Magnet = 1 Among the schools with the SAT test takers of over 500, please list the schools that are magnet schools or offer a magnet program. Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.School FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode WHERE T2.Magnet = 1 AND T1.NumTstTakr > 500
Magnet schools or offer a magnet program means that Magnet = 1
What is the phone number of the school that has the highest number of test takers with an SAT score of over 1500?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: What is the phone number of the school that has the highest number of test takers with an SAT score of over 1500? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.Phone FROM satscores AS T1 INNER JOIN schools AS T2 ON T1.cds = T2.CDSCode ORDER BY T1.NumGE1500 DESC LIMIT 1
None
What is the number of SAT test takers of the schools with the highest FRPM count for K-12 students?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: What is the number of SAT test takers of the schools with the highest FRPM count for K-12 students? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT NumTstTakr FROM satscores WHERE cds = ( SELECT CDSCode FROM frpm ORDER BY `FRPM Count (K-12)` DESC LIMIT 1 )
None
Among the schools with the average score in Math over 560 in the SAT test, how many schools are directly charter-funded?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Among the schools with the average score in Math over 560 in the SAT test, how many schools are directly charter-funded? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT COUNT(T2.`School Code`) FROM satscores AS T1 INNER JOIN frpm AS T2 ON T1.cds = T2.CDSCode WHERE T1.AvgScrMath > 560 AND T2.`Charter Funding Type` = 'Directly funded'
None
For the school with the highest average score in Reading in the SAT test, what is its FRPM count for students aged 5-17?
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Reading', 'Read', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Reading', 'Read', 'Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. 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? Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.`FRPM Count (Ages 5-17)` FROM satscores AS T1 INNER JOIN frpm AS T2 ON T1.cds = T2.CDSCode ORDER BY T1.AvgScrRead DESC LIMIT 1
None
Please list the codes of the schools with a total enrollment of over 500.
CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) );
Task Overview: You are a data science expert. Below, you are provided with a database schema and a natural language question. Your task is to understand the schema and generate a valid SQL query to answer the question. Database Engine: SQLite Database Schema: CREATE TABLE frpm ( CDSCode text, -- example: ['01100170109835', '01100170112607'] `Academic Year` text, -- example: ['2014-2015'] `County Code` text, -- example: ['01', '02'] `District Code` integer, -- example: [10017, 31609] `School Code` text, -- example: ['0109835', '0112607'] `County Name` text, -- example: ['Alameda', 'Alpine'] `District Name` text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] `School Name` text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] `District Type` text, -- example: ['County Office of Education (COE)', 'State Special Schools'] `School Type` text, -- example: ['K-12 Schools (Public)', 'High Schools (Public)'] `Educational Option Type` text, -- example: ['Traditional', 'Juvenile Court School'] `NSLP Provision Status` text, -- example: ['Breakfast Provision 2', 'Provision 2'] `Charter School (Y/N)` integer, -- example: [1, 0] `Charter School Number` text, -- example: ['0728', '0811'] `Charter Funding Type` text, -- example: ['Directly funded', 'Locally funded'] IRC integer, -- example: [1, 0] `Low Grade` text, -- example: ['K', '9'] `High Grade` text, -- example: ['12', '8'] `Enrollment (K-12)` real, -- example: [1087.0, 395.0] `Free Meal Count (K-12)` real, -- example: [565.0, 186.0] `Percent (%) Eligible Free (K-12)` real, -- example: [0.519779208831647, 0.470886075949367] `FRPM Count (K-12)` real, -- example: [715.0, 186.0] `Percent (%) Eligible FRPM (K-12)` real, -- example: [0.657773689052438, 0.470886075949367] `Enrollment (Ages 5-17)` real, -- example: [1070.0, 376.0] `Free Meal Count (Ages 5-17)` real, -- example: [553.0, 182.0] `Percent (%) Eligible Free (Ages 5-17)` real, -- example: [0.516822429906542, 0.484042553191489] `FRPM Count (Ages 5-17)` real, -- example: [702.0, 182.0] `Percent (%) Eligible FRPM (Ages 5-17)` real, -- example: [0.65607476635514, 0.484042553191489] `2013-14 CALPADS Fall 1 Certification Status` integer, -- example: [1] PRIMARY KEY (CDSCode), CONSTRAINT fk_frpm_cdscode FOREIGN KEY (CDSCode) REFERENCES schools (CDSCode) ); CREATE TABLE satscores ( cds text, -- example: ['10101080000000', '10101080109991'] rtype text, -- example: ['D', 'S'] sname text, -- school name, example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] dname text, -- district name, example: ['Alameda County Office of Education', 'Alameda Unified'] cname text, -- county name, example: ['Alameda', 'Amador'] enroll12 integer, -- enrollment (1st-12nd grade), example: [398, 62] NumTstTakr integer, -- Number of Test Takers, example: [88, 17] AvgScrRead integer, -- average scores in Reading, example: [418, 503] AvgScrMath integer, -- average scores in Math, example: [418, 546] AvgScrWrite integer, -- average scores in writing, example: [417, 505] NumGE1500 integer, -- Number of Test Takers Whose Total SAT Scores Are Greater or Equal to 1500, example: [14, 9] PRIMARY KEY (cds), CONSTRAINT fk_satscores_cds FOREIGN KEY (cds) REFERENCES schools (CDSCode) ); CREATE TABLE schools ( CDSCode text, -- example: ['01100170000000', '01100170109835'] NCESDist text, -- National Center for Educational Statistics school district identification number, example: ['0691051', '0600002'] NCESSchool text, -- National Center for Educational Statistics school identification number, example: ['10546', '10947'] StatusType text, -- example: ['Active', 'Closed'] County text, -- example: ['Alameda', 'Alpine'] District text, -- example: ['Alameda County Office of Education', 'California School for the Blind (State S'] School text, -- example: ['FAME Public Charter', 'Envision Academy for Arts & Technology'] Street text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] StreetAbr text, -- street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] City text, -- example: ['Hayward', 'Newark'] Zip text, -- example: ['94544-1136', '94560-5359'] State text, -- example: ['CA'] MailStreet text, -- example: ['313 West Winton Avenue', '39899 Balentine Drive, Suite 335'] MailStrAbr text, -- mailing street address, example: ['313 West Winton Ave.', '39899 Balentine Dr., Ste. 335'] MailCity text, -- mailing city, example: ['Hayward', 'Newark'] MailZip text, -- mailing zip, example: ['94544-1136', '94560-5359'] MailState text, -- mailing state, example: ['CA'] Phone text, -- example: ['(510) 887-0152', '(510) 596-8901'] Ext text, -- extension, example: ['130', '1240'] Website text, -- example: ['www.acoe.org', 'www.envisionacademy.org/'] OpenDate date, -- example: ['2005-08-29', '2006-08-28'] ClosedDate date, -- example: ['2015-07-31', '2015-06-30'] Charter integer, -- example: [1, 0] CharterNum text, -- example: ['0728', '0811'] FundingType text, -- example: ['Directly funded', 'Locally funded'] DOC text, -- District Ownership Code, example: ['00', '31'] DOCType text, -- The District Ownership Code Type, example: ['County Office of Education (COE)', 'State Special Schools'] SOC text, -- School Ownership Code, example: ['65', '66'] SOCType text, -- School Ownership Code Type, example: ['K-12 Schools (Public)', 'High Schools (Public)'] EdOpsCode text, -- Education Option Code, example: ['TRAD', 'JUV'] EdOpsName text, -- Educational Option Name, example: ['Traditional', 'Juvenile Court School'] EILCode text, -- Educational Instruction Level Code, example: ['ELEMHIGH', 'HS'] EILName text, -- Educational Instruction Level Name, example: ['Elementary-High Combination', 'High School'] GSoffered text, -- grade span offered, example: ['K-12', '9-12'] GSserved text, -- grade span served., example: ['K-12', '9-12'] Virtual text, -- example: ['P', 'N'] Magnet integer, -- example: [0, 1] Latitude real, -- example: [37.658212, 37.521436] Longitude real, -- example: [-122.09713, -121.99391] AdmFName1 text, -- administrator's first name 1, example: ['L Karen', 'Laura'] AdmLName1 text, -- administrator's last name 1, example: ['Monroe', 'Robell'] AdmEmail1 text, -- administrator's email address 1, example: ['lkmonroe@acoe.org', 'laura@envisionacademy.org'] AdmFName2 text, -- administrator's first name 2, example: ['Sau-Lim (Lance)', 'Jennifer'] AdmLName2 text, -- administrator's last name 2, example: ['Tsang', 'Koelling'] AdmEmail2 text, -- administrator's email address 2, example: ['stsang@unityhigh.org', 'jkoelling@efcps.net'] AdmFName3 text, -- administrator's first name 3, example: ['Drew', 'Irma'] AdmLName3 text, -- administrator's last name 3, example: ['Sarratore', 'Munoz'] AdmEmail3 text, -- administrator's email address 3, example: ['dsarratore@vincentacademy.org', 'gmunoz@piedmont.k12.ca.us'] LastUpdate date, -- example: ['2015-06-23', '2015-09-01'] PRIMARY KEY (CDSCode) ); This schema describes the database's structure, including tables, columns, primary keys, foreign keys, and any relevant relationships or constraints. Question: Total enrollment can be represented by `Enrollment (K-12)` + `Enrollment (Ages 5-17)` Please list the codes of the schools with a total enrollment of over 500. Instructions: - Make sure you only output the information that is asked in the question. If the question asks for a specific column, make sure to only include that column in the SELECT clause, nothing more. - The generated query should return all of the information asked in the question without any missing or extra information. - Before generating the final SQL query, please think through the steps of how to write the query. Output Format: In your answer, please enclose the generated SQL query in a code block: ```sql -- Your SQL query ``` Take a deep breath and think step by step to find the correct SQL query.
SELECT T2.CDSCode FROM schools AS T1 INNER JOIN frpm AS T2 ON T1.CDSCode = T2.CDSCode WHERE T2.`Enrollment (K-12)` + T2.`Enrollment (Ages 5-17)` > 500
Total enrollment can be represented by `Enrollment (K-12)` + `Enrollment (Ages 5-17)`
End of preview.
YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/datasets-cards)

Dataset Description

This dataset contains dataset files used for evaluating NovaSky-AI/SkyRL-SQL-7B.

Dataset Files

The dataset contains Spider Dev set, Spider Test set, Spider DK, Spider Realistic and Spider Synthetic generated in the format of OmniSQL but with individual fields for question, schema and external_knowledge available.

Downloads last month
59

Collection including NovaSky-AI/SkyRL-SQL-eval