input
stringlengths
358
16.1k
output
stringlengths
24
805
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the precise locations of the cities with an area code of 787? [/INST]
SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = '787' GROUP BY T2.latitude, T2.longitude;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: In California, how many delivery receptacles are there in the community post office that has the highest number of delivery receptacles? [/INST]
SELECT COUNT(*) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.abbreviation = 'CA' AND T2.type LIKE '%Community Post Office%' AND T1.name = 'California' AND T2.state = 'CA';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: In which county can you find the city with the highest number of females? [/INST]
SELECT T4.county FROM zip_data AS T3 INNER JOIN country AS T4 ON T3.zip_code = T4.zip_code GROUP BY T4.county ORDER BY T3.female_population DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the names of the states whose postal point is not affiliated with any organization? [/INST]
SELECT DISTINCT T2.name FROM zip_data AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation WHERE T1.division IS NULL;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the difference in the most populated city of Allentown-Bethlehem-Easton, PA-NJ in 2020 against its population in 2010? [/INST]
SELECT T1.population_2020 - T1.population_2010 AS result_data FROM zip_data AS T1 INNER JOIN CBSA AS T2 ON T1.CBSA = T2.CBSA WHERE T2.CBSA_name = 'Allentown-Bethlehem-Easton, PA-NJ' ORDER BY T1.population_2020 DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all the zip codes in the county of New Castle in Delaware. [/INST]
SELECT DISTINCT T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T2.county = 'NEW CASTLE' AND T1.name = 'Delaware';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many representatives are there in the state with the highest monthly benefit payments for retired workers? [/INST]
SELECT COUNT(T3.cognress_rep_id) FROM zip_data AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation INNER JOIN congress AS T3 ON T2.abbreviation = T3.abbreviation ORDER BY T1.monthly_benefits_retired_workers DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: In the state where Lisa Murkowski is the representative, how many cities have zero employees? [/INST]
SELECT COUNT(T3.city) FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T1.first_name = 'Murkowski' AND T1.last_name = 'Lisa' AND T3.employees = 0;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the top 3 states with the highest Asian population? List the full names of all the representatives in the said states. [/INST]
SELECT t.state, T1.first_name, T1.last_name FROM zip_data AS T INNER JOIN congress AS T1 ON t.state = T1.abbreviation GROUP BY t.state ORDER BY SUM(t.asian_population) DESC LIMIT 3;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which state is Outagamie County in? Give the full name of the state. [/INST]
SELECT DISTINCT T2.name FROM country AS T1 INNER JOIN state AS T2 ON T1.state = T2.abbreviation WHERE T1.county = 'OUTAGAMIE';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What party does the area with the zip code 91701 belong to? [/INST]
SELECT T1.party FROM congress AS T1 INNER JOIN state AS T2 ON T1.abbreviation = T2.abbreviation INNER JOIN zip_data AS T3 ON T2.abbreviation = T3.state WHERE T3.zip_code = 91701 GROUP BY T1.party;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many males are there in New Haven County's residential areas? [/INST]
SELECT SUM(T1.male_population) FROM zip_data AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T2.county = 'NEW HAVEN';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Show the alias for the county at coordinate (18.090875, -66.867756). [/INST]
SELECT T2.alias FROM zip_data AS T1 INNER JOIN alias AS T2 ON T1.zip_code = T2.zip_code WHERE T1.latitude = 18.090875 AND T1.longitude = -66.867756;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: For the city with the most elders, what's its area code? [/INST]
SELECT T2.area_code FROM zip_data AS T1 INNER JOIN area_code AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.area_code ORDER BY T1.over_65 DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: For the county represented by Thompson Bennie G, how many bad aliases does it have? [/INST]
SELECT COUNT(DISTINCT T2.bad_alias) FROM zip_congress AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T1.district = T3.cognress_rep_id WHERE T3.first_name = 'Thompson' AND T3.last_name = 'Bennie G';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Give the location coordinates of the city with area code 636. [/INST]
SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 636;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Show the zip code of the county represented by Buchanan Vernon. [/INST]
SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'Buchanan' AND T1.last_name = 'Vernon';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which state is area code 878 in? Give the name of the state. [/INST]
SELECT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 878;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many counties are there in Virginia State? [/INST]
SELECT COUNT(T2.county) FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virginia';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Give the name and the position of the cbsa officer from the area with the zip code 45503. [/INST]
SELECT T1.CBSA_name, T2.latitude, T2.longitude FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.zip_code = 45503 GROUP BY T1.CBSA_name, T2.latitude, T2.longitude;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Tell the name of the county which is represented by Hartzler Vicky. [/INST]
SELECT T1.county FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Hartzler' AND T3.last_name = 'Vicky' GROUP BY T1.county;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Calculate the average male median age of all the residential areas in Windham county. [/INST]
SELECT SUM(T2.male_median_age) / COUNT(T2.median_age) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WINDHAM';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: For the county where DeSantis Ron is from, what is the average female median age? [/INST]
SELECT SUM(T4.female_median_age) / COUNT(T1.county) FROM country AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id INNER JOIN zip_data AS T4 ON T1.zip_code = T4.zip_code WHERE T3.first_name = 'DeSantis' AND T3.last_name = 'Ron';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the area code of Bishopville, SC? [/INST]
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Bishopville' AND T2.state = 'SC';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Name the bad alias of Geneva, AL. [/INST]
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Geneva' AND T2.state = 'AL';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which city and state has the bad alias of Lawrenceville? [/INST]
SELECT T2.city, T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Lawrenceville' GROUP BY T2.city, T2.state;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Name both the alias and the bad alias of zip code 38015. [/INST]
SELECT T1.alias, T2.bad_alias FROM alias AS T1 INNER JOIN avoid AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 38015;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the zip code of the district represented by Steven A King? [/INST]
SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.first_name = 'King' AND T1.last_name = 'Steven A';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the CBSA name and type in York, ME? [/INST]
SELECT T1.CBSA_name, T1.CBSA_type FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'York' AND T2.state = 'ME';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List 10 cities with a median age over 40. Include their zip codes and area codes. [/INST]
SELECT T2.city, T2.zip_code, T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.median_age >= 40 LIMIT 10;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Name the county that has the bad alias of Druid Hills. [/INST]
SELECT T2.county FROM avoid AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Druid Hills';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the area code of Phillips county in Montana? [/INST]
SELECT DISTINCT T1.area_code FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN state AS T3 ON T2.state = T3.abbreviation WHERE T2.county = 'PHILLIPS' AND T3.name = 'Montana';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which district has the largest land area in Wisconsin? Write the full name of the congress representative and include the postal codes. [/INST]
SELECT T2.zip_code, T1.first_name, T1.last_name FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.state = 'Wisconsin' ORDER BY T1.land_area DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many states are in the central time zone? Write their full names. [/INST]
SELECT SUM(CASE WHEN T1.time_zone = 'Central' THEN 1 ELSE 0 END) AS count FROM zip_data AS T1 INNER JOIN state AS T2 ON T2.abbreviation = T1.state WHERE T1.time_zone = 'Central';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Name 10 cities with their states that are under the Lexington-Fayette, KY office of the Canada Border Services Agency. [/INST]
SELECT DISTINCT T2.city, T2.state FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Lexington-Fayette, KY' LIMIT 10;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the percentage ratio between Democrats and Republicans in Indiana? List the zip codes belonging to Democrats. [/INST]
SELECT CAST(COUNT(CASE WHEN T2.party = 'Democrat' THEN 1 ELSE NULL END) AS REAL) / COUNT(CASE WHEN T2.party = 'Republican' THEN 1 ELSE NULL END)FROM zip_congress AS T1 INNER JOIN congress AS T2 ON T2.cognress_rep_id = T1.district;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Calculate the ratio between the number of representatives in Alabama and the number of representatives in Illinois. [/INST]
SELECT CAST(COUNT(CASE WHEN state = 'Alabama' THEN cognress_rep_id ELSE NULL END) AS REAL) / COUNT(CASE WHEN state = 'Illinois' THEN cognress_rep_id ELSE NULL END) FROM congress;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Calculate the average of 2020's population in each zip code. [/INST]
SELECT CAST(SUM(population_2020) AS REAL) / COUNT(zip_code) FROM zip_data;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: State the male population for all zip code which were under the Berlin, NH CBSA. [/INST]
SELECT T2.male_population FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Berlin, NH' GROUP BY T2.male_population;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which CBSAs have more than 10 zip codes? [/INST]
SELECT T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA GROUP BY T1.CBSA HAVING COUNT(T2.zip_code) > 10;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all the bad alias for zip codes in Puerto Rico. [/INST]
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.state = 'PR';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the longitude and latitude for the district represented by Grayson Alan? [/INST]
SELECT T1.latitude, T1.longitude FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Grayson' AND T3.last_name = 'Alan';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the state for area code of 787? [/INST]
SELECT DISTINCT T2.state FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all representatives of districts which have more than 30 000 population in 2020. [/INST]
SELECT T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.population_2020 > 30000 GROUP BY T3.first_name, T3.last_name;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which zip code in Massachusetts that have more than 1 area code? [/INST]
SELECT T1.zip_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.state = 'MA' GROUP BY T1.zip_code HAVING COUNT(T1.area_code) > 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: State the county for Arecibo City. [/INST]
SELECT DISTINCT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Arecibo';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many zip codes are under Barre, VT? [/INST]
SELECT COUNT(T2.zip_code) FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Barre, VT';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the zip code under Saint Croix county, which zip code has the biggest land area? [/INST]
SELECT T1.zip_code FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'SAINT CROIX' ORDER BY T2.land_area DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Calculate the difference between the 2020 population and the 2010 population for the districts represented by Griffin Tim. [/INST]
SELECT T1.population_2020 - T1.population_2010 FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Griffin' AND T3.last_name = 'Tim';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Based on the population in 2020, calculate the percentage for the population of Asian in the zip code where the CBSA was Atmore, AL. [/INST]
SELECT CAST(T2.asian_population AS REAL) * 100 / T2.population_2010 FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Atmore, AL';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the cities with an area code 939, which city has the highest Asian population? [/INST]
SELECT T2.city FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 939 ORDER BY T2.asian_population DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Give the name of the country and state of the city with elevation of 1039. [/INST]
SELECT DISTINCT T1.name, T2.state FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T3.elevation = 1039;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the alias and elevation of the city with zip code 1028. [/INST]
SELECT T1.alias, T2.elevation FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 1028;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the area code of the city with the largest land area? [/INST]
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.land_area = ( SELECT MAX(land_area) FROM zip_data );
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Give the area code of the city with the white population ranging between 1700 to 2000. [/INST]
SELECT T1.area_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.white_population BETWEEN 1700 AND 2000;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the Asian population in the city with the alias Leeds? [/INST]
SELECT SUM(T2.asian_population) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Leeds';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List down the area code and country of the city named Savoy. [/INST]
SELECT T1.area_code, T2.county FROM area_code AS T1 INNER JOIN country AS T2 ON T1.zip_code = T2.zip_code INNER JOIN zip_data AS T3 ON T1.zip_code = T3.zip_code WHERE T3.city = 'Savoy';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the alias of the cities with 0 population in 2010? [/INST]
SELECT DISTINCT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.population_2010 = 0;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the cities with area code 608, how many cities implement daylight savings? [/INST]
SELECT COUNT(T2.city) FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 608 AND T2.daylight_savings = 'Yes';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the average elevation of the cities with alias Amherst. [/INST]
SELECT AVG(T2.elevation) FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.alias = 'Amherst';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the country and state of the city named Dalton? [/INST]
SELECT T2.county FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state INNER JOIN zip_data AS T3 ON T2.zip_code = T3.zip_code WHERE T3.city = 'Dalton' GROUP BY T2.county;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Give at least five alias of cities with a postal point of post office. [/INST]
SELECT T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.type = 'Post Office' LIMIT 5;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the difference in the number of cities with P.O. box only and cities with Post Office among the cities with area code 787? [/INST]
SELECT COUNT(CASE WHEN T2.type = 'P.O. Box Only' THEN 1 ELSE NULL END) - COUNT(CASE WHEN T2.type = 'Post Office' THEN 1 ELSE NULL END) AS DIFFERENCE FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 787;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the cities belonging to the country named Arroyo, calculate the percentage of increase in the population in these cities from 2010 to 2020. [/INST]
SELECT CAST((SUM(T2.population_2020) - SUM(T2.population_2010)) AS REAL) * 100 / SUM(T2.population_2010) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Arroyo';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the postal points in Texas, provide the zip codes and cities of postal points which have total beneficiaries of above 10000. [/INST]
SELECT T2.zip_code, T2.city FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Texas' AND T2.total_beneficiaries > 10000;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the postal points in the District of Columbia, how many of them have an area with above 20000 black population? [/INST]
SELECT COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'DISTRICT OF COLUMBIA' AND T2.black_population > 20000;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the city where zip code 19019 is located and the alias of that city. [/INST]
SELECT T2.city, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.zip_code = 19019;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List the bad alias of the postal point located in Camuy. [/INST]
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Camuy';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the zip code, city, and congress representative's full names of the area which has highest population in 2020. [/INST]
SELECT T1.zip_code, T1.city, T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id GROUP BY T2.district ORDER BY T1.population_2020 DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the daylight savings areas in the Midwest region, how many postal points are there in Illinois? [/INST]
SELECT COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Illinois' AND T2.daylight_savings = 'Yes' AND T2.region = 'Midwest';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the countries and the zip codes in the Virgin Islands. [/INST]
SELECT T2.county, T2.zip_code FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Virgin Islands';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the zip codes and the alias of Greeneville. [/INST]
SELECT T2.zip_code, T1.alias FROM alias AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Greeneville';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Compare the numbers of postal points under Smith Adrian and Heck Joe. [/INST]
SELECT CASE WHEN COUNT(CASE WHEN T1.first_name = 'Smith' AND T1.last_name = 'Adrian' THEN T2.zip_code ELSE NULL END) > COUNT(CASE WHEN T1.first_name = 'Heck' AND T1.last_name = 'Joe' THEN T2.zip_code ELSE NULL END) THEN 'Smith Adrian>Heck Joe' ELSE 'Smith Adrian<=Heck Joe' END AS COMPARE FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the zip codes and CBSA officers of the postal point in Oxford. [/INST]
SELECT T2.zip_code, T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Oxford';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the zip codes and their affiliated organization for the postal point under Kingsport-Bristol, TN-VA. [/INST]
SELECT T2.zip_code, T2.organization FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_name = 'Kingsport-Bristol, TN-VA';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the zip codes and the congress representatives' names of the postal points which are affiliated with Readers Digest. [/INST]
SELECT T1.zip_code, T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.organization = 'Readers Digest';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Among the postal points in California, calculate the percentage of them in post office types. [/INST]
SELECT CAST(COUNT(CASE WHEN T2.type = 'Post Office' THEN T2.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T2.zip_code) FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'California';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the zip code for the Senate house? [/INST]
SELECT T2.zip_code FROM congress AS T1 INNER JOIN zip_congress AS T2 ON T1.cognress_rep_id = T2.district WHERE T1.House = 'House of Repsentatives' GROUP BY T2.zip_code;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which city has the most bad aliases? [/INST]
SELECT T2.city FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T1.bad_alias ORDER BY COUNT(T1.zip_code) DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all the counties in Georgia. [/INST]
SELECT T2.county FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state WHERE T1.name = 'Georgia' GROUP BY T2.county;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all the locations of postal points with the area code "410". [/INST]
SELECT T2.latitude, T2.longitude FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.area_code = 410;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the name of the CBSA of the city with the highest average house value? [/INST]
SELECT DISTINCT T1.CBSA_name FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.avg_house_value = ( SELECT MAX(avg_house_value) FROM zip_data ) LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the bad aliases of the postal points from East Setauket? [/INST]
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'East Setauket';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What was the population of Wilcox County in 2010? [/INST]
SELECT SUM(T2.population_2010) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'WILCOX';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the code of the area with the largest Asian population? [/INST]
SELECT T1.zip_code FROM area_code AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.asian_population ORDER BY T2.asian_population DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: List all the cities with micro CBSA. [/INST]
SELECT T2.city FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_type = 'Micro';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the name of the state with the most counties? [/INST]
SELECT T1.name FROM state AS T1 INNER JOIN country AS T2 ON T1.abbreviation = T2.state GROUP BY T2.state ORDER BY COUNT(T2.county) DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the number of households in the "FL-10" district? [/INST]
SELECT SUM(CASE WHEN T2.district = 'FL-10' THEN 1 ELSE 0 END) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the average household income in the city known as "Danzig"? [/INST]
SELECT T2.avg_income_per_household FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.bad_alias = 'Danzig';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What are the states with an above-average female population? [/INST]
SELECT DISTINCT T2.state FROM state AS T1 INNER JOIN zip_data AS T2 ON T1.abbreviation = T2.state WHERE T2.female_population > ( SELECT AVG(female_population) FROM zip_data );
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What percentage of households are in "Coroyell" out of its state? [/INST]
SELECT CAST(SUM(CASE WHEN T1.county = 'CORYELL' THEN T2.households ELSE 0 END) AS REAL) * 100 / SUM(T2.households) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the name and the position of the CBSA officer in the city of Cabo Rojo? [/INST]
SELECT T1.CBSA_name, T1.CBSA_type FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T2.city = 'Cabo Rojo' GROUP BY T1.CBSA_name, T1.CBSA_type;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Indicate the country name of the city Las Marias. [/INST]
SELECT T1.county FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Las Marias';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: How many cities does congressman Pierluisi Pedro represent? [/INST]
SELECT COUNT(DISTINCT T1.city) FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T3.first_name = 'Pierluisi' AND T3.last_name = 'Pedro';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the names of bad aliases in the city of Aguadilla. [/INST]
SELECT T1.bad_alias FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T2.city = 'Aguadilla';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Indicate the name of the congressman represent in Guanica. [/INST]
SELECT T3.first_name, T3.last_name FROM zip_data AS T1 INNER JOIN zip_congress AS T2 ON T1.zip_code = T2.zip_code INNER JOIN congress AS T3 ON T2.district = T3.cognress_rep_id WHERE T1.city = 'Guanica';
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which state has the most bad aliases? [/INST]
SELECT T2.state FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code GROUP BY T2.state ORDER BY COUNT(T1.bad_alias) DESC LIMIT 1;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: What is the difference in the number of bad alias between Aguada city and Aguadilla city? [/INST]
SELECT COUNT(CASE WHEN T2.city = 'Aguada' THEN T1.bad_alias ELSE NULL END) - COUNT(CASE WHEN T2.city = 'Aguadilla' THEN T1.bad_alias ELSE NULL END) AS DIFFERENCE FROM avoid AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Which state has greater than 50 CBSA officers of metro type? [/INST]
SELECT T2.state FROM CBSA AS T1 INNER JOIN zip_data AS T2 ON T1.CBSA = T2.CBSA WHERE T1.CBSA_type = 'Metro' GROUP BY T2.state HAVING COUNT(T1.CBSA_type) > 50;
[INST] Here is a database schema: CBSA : CBSA [ INTEGER ] primary_key CBSA_name [ TEXT ] CBSA_type [ TEXT ] state : abbreviation [ TEXT ] primary_key name [ TEXT ] congress : cognress_rep_id [ TEXT ] primary_key first_name [ TEXT ] last_name [ TEXT ] CID [ TEXT ] party [ TEXT ] state [ TEXT ] abbreviation [ TEXT ] congress.abbreviation = state.abbreviation House [ TEXT ] District [ INTEGER ] land_area [ REAL ] zip_data : zip_code [ INTEGER ] primary_key city [ TEXT ] state [ TEXT ] zip_data.state = state.abbreviation multi_county [ TEXT ] type [ TEXT ] organization [ TEXT ] time_zone [ TEXT ] daylight_savings [ TEXT ] latitude [ REAL ] longitude [ REAL ] elevation [ INTEGER ] state_fips [ INTEGER ] county_fips [ INTEGER ] region [ TEXT ] division [ TEXT ] population_2020 [ INTEGER ] population_2010 [ INTEGER ] households [ INTEGER ] avg_house_value [ INTEGER ] avg_income_per_household [ INTEGER ] persons_per_household [ REAL ] white_population [ INTEGER ] black_population [ INTEGER ] hispanic_population [ INTEGER ] asian_population [ INTEGER ] american_indian_population [ INTEGER ] hawaiian_population [ INTEGER ] other_population [ INTEGER ] male_population [ INTEGER ] female_population [ INTEGER ] median_age [ REAL ] male_median_age [ REAL ] female_median_age [ REAL ] residential_mailboxes [ INTEGER ] business_mailboxes [ INTEGER ] total_delivery_receptacles [ INTEGER ] businesses [ INTEGER ] 1st_quarter_payroll [ INTEGER ] annual_payroll [ INTEGER ] employees [ INTEGER ] water_area [ REAL ] land_area [ REAL ] single_family_delivery_units [ INTEGER ] multi_family_delivery_units [ INTEGER ] total_beneficiaries [ INTEGER ] retired_workers [ INTEGER ] disabled_workers [ INTEGER ] parents_and_widowed [ INTEGER ] spouses [ INTEGER ] children [ INTEGER ] over_65 [ INTEGER ] monthly_benefits_all [ INTEGER ] monthly_benefits_retired_workers [ INTEGER ] monthly_benefits_widowed [ INTEGER ] CBSA [ INTEGER ] zip_data.CBSA = CBSA.CBSA alias : zip_code [ INTEGER ] primary_key alias.zip_code = zip_data.zip_code alias [ TEXT ] area_code : zip_code [ INTEGER ] area_code.zip_code = zip_data.zip_code area_code [ INTEGER ] avoid : zip_code [ INTEGER ] avoid.zip_code = zip_data.zip_code bad_alias [ TEXT ] country : zip_code [ INTEGER ] country.zip_code = zip_data.zip_code county [ TEXT ] state [ TEXT ] country.state = state.abbreviation zip_congress : zip_code [ INTEGER ] zip_congress.zip_code = zip_data.zip_code district [ TEXT ] zip_congress.district = congress.cognress_rep_id Please write me a SQL statement that answers the following question: Provide the population of Arecibo in 2020. [/INST]
SELECT SUM(T2.population_2020) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code WHERE T1.county = 'ARECIBO';