Database schema:

CREATE TABLE "CBSA" (
	"CBSA" INTEGER -- example: ['10380', '10300'],
	"CBSA_name" TEXT -- example: ['Adrian, MI', 'Aguadilla-Isabela, PR'],
	"CBSA_type" TEXT -- example: ['Micro', 'Metro'],
	PRIMARY KEY ("CBSA")
)


CREATE TABLE alias (
	zip_code INTEGER -- example: ['544', '501'],
	alias TEXT -- example: ['Holtsville', 'Adjuntas'],
	PRIMARY KEY (zip_code), 
	CONSTRAINT fk_alias_zip_data FOREIGN KEY(zip_code) REFERENCES zip_data (zip_code)
)


CREATE TABLE area_code (
	zip_code INTEGER -- example: ['544', '501'],
	area_code INTEGER -- example: ['631', '787'],
	PRIMARY KEY (zip_code, area_code), 
	CONSTRAINT fk_area_code_zip_data FOREIGN KEY(zip_code) REFERENCES zip_data (zip_code)
)


CREATE TABLE avoid (
	zip_code INTEGER -- example: ['544', '501'],
	bad_alias TEXT -- example: ['Colinas Del Gigante', 'Internal Revenue Service'],
	PRIMARY KEY (zip_code, bad_alias), 
	CONSTRAINT fk_avoid_zip_data FOREIGN KEY(zip_code) REFERENCES zip_data (zip_code)
)


CREATE TABLE congress (
	cognress_rep_id TEXT -- example: ['AK', 'AK-S1'],
	first_name TEXT -- example: ['Young', 'Begich'],
	last_name TEXT -- example: ['Don', 'Mark'],
	"CID" TEXT -- example: ['N00008091', 'N00009585'],
	party TEXT -- example: ['Republican', 'Democrat'],
	state TEXT -- example: ['Alaska', 'Alabama'],
	abbreviation TEXT -- example: ['AK', 'AL'],
	"House" TEXT -- example: ['House of Repsentatives', 'Senate'],
	"District" INTEGER -- example: ['2', '1'],
	land_area REAL -- example: ['571951.26', '570641.0'],
	PRIMARY KEY (cognress_rep_id), 
	CONSTRAINT fk_congress_state FOREIGN KEY(abbreviation) REFERENCES state (abbreviation)
)


CREATE TABLE country (
	zip_code INTEGER -- example: ['544', '501'],
	county TEXT -- example: ['SUFFOLK', 'ADJUNTAS'],
	state TEXT -- example: ['NY', 'PR'],
	PRIMARY KEY (zip_code, county), 
	CONSTRAINT fk_country_zip_data FOREIGN KEY(zip_code) REFERENCES zip_data (zip_code),
	CONSTRAINT fk_country_state FOREIGN KEY(state) REFERENCES state (abbreviation)
)


CREATE TABLE state (
	abbreviation TEXT -- example: ['AE', 'AA'],
	name TEXT -- example: ['Armed Forces Europe', 'Armed Forces Americas'],
	PRIMARY KEY (abbreviation)
)


CREATE TABLE zip_congress (
	zip_code INTEGER -- example: ['601', '501'],
	district TEXT -- example: ['PR', 'NY-1'],
	PRIMARY KEY (zip_code, district), 
	CONSTRAINT fk_zip_congress_congress FOREIGN KEY(district) REFERENCES congress (cognress_rep_id),
	CONSTRAINT fk_zip_congress_zip_data FOREIGN KEY(zip_code) REFERENCES zip_data (zip_code)
)


CREATE TABLE zip_data (
	zip_code INTEGER -- example: ['544', '501'],
	city TEXT -- example: ['Holtsville', 'Adjuntas'],
	state TEXT -- example: ['NY', 'PR'],
	multi_county TEXT -- example: ['No', 'Yes'],
	type TEXT -- example: ['Unique Post Office', 'Post Office'],
	organization TEXT -- example: ['Irs Service Center', 'I R S Service Center'],
	time_zone TEXT -- example: ['Atlantic', 'Eastern'],
	daylight_savings TEXT -- example: ['No', 'Yes'],
	latitude REAL -- example: ['40.788827', '40.817923'],
	longitude REAL -- example: ['-73.039405', '-73.045317'],
	elevation INTEGER -- example: ['0', '25'],
	state_fips INTEGER -- example: ['72', '36'],
	county_fips INTEGER -- example: ['1', '103'],
	region TEXT -- example: ['Northeast', 'South'],
	division TEXT -- example: ['New England', 'Middle Atlantic'],
	population_2020 INTEGER -- example: ['0', '11737'],
	population_2010 INTEGER -- example: ['0', '18570'],
	households INTEGER -- example: ['0', '6525'],
	avg_house_value INTEGER -- example: ['0', '86200'],
	avg_income_per_household INTEGER -- example: ['0', '13092'],
	persons_per_household REAL -- example: ['2.84', '0.0'],
	white_population INTEGER -- example: ['0', '17479'],
	black_population INTEGER -- example: ['0', '663'],
	hispanic_population INTEGER -- example: ['0', '18486'],
	asian_population INTEGER -- example: ['0', '7'],
	american_indian_population INTEGER -- example: ['0', '113'],
	hawaiian_population INTEGER -- example: ['0', '10'],
	other_population INTEGER -- example: ['0', '558'],
	male_population INTEGER -- example: ['0', '9078'],
	female_population INTEGER -- example: ['0', '9492'],
	median_age REAL -- example: ['0.0', '35.9'],
	male_median_age REAL -- example: ['0.0', '34.5'],
	female_median_age REAL -- example: ['0.0', '37.1'],
	residential_mailboxes INTEGER -- example: ['0', '4133'],
	business_mailboxes INTEGER -- example: ['0', '1'],
	total_delivery_receptacles INTEGER -- example: ['0', '1'],
	businesses INTEGER -- example: ['2', '0'],
	"1st_quarter_payroll" INTEGER -- example: ['0', '88685000'],
	annual_payroll INTEGER -- example: ['0', '376492000'],
	employees INTEGER -- example: ['0', '9127'],
	water_area REAL -- example: ['0.0', '0.309'],
	land_area REAL -- example: ['0.0', '64.348'],
	single_family_delivery_units INTEGER -- example: ['0', '2419'],
	multi_family_delivery_units INTEGER -- example: ['0', '1264'],
	total_beneficiaries INTEGER -- example: ['0', '5135'],
	retired_workers INTEGER -- example: ['0', '2940'],
	disabled_workers INTEGER -- example: ['0', '885'],
	parents_and_widowed INTEGER -- example: ['0', '155'],
	spouses INTEGER -- example: ['0', '145'],
	children INTEGER -- example: ['0', '1010'],
	over_65 INTEGER -- example: ['0', '3245'],
	monthly_benefits_all INTEGER -- example: ['0', '6137000'],
	monthly_benefits_retired_workers INTEGER -- example: ['0', '4007000'],
	monthly_benefits_widowed INTEGER -- example: ['0', '185000'],
	"CBSA" INTEGER -- example: ['38660', '35620'],
	PRIMARY KEY (zip_code), 
	CONSTRAINT fk_zip_data_state FOREIGN KEY(state) REFERENCES state (abbreviation),
	CONSTRAINT fk_zip_data_cbsa FOREIGN KEY("CBSA") REFERENCES "CBSA" ("CBSA")
)

Question: Calculate the percentage of households in residential areas of countries over 10000.
Evidence: DIVIDE(SUM(households > 10000), SUM(households)) as percentage;

SQL:
SELECT CAST(COUNT(CASE WHEN T2.households > 10000 THEN T1.zip_code ELSE NULL END) AS REAL) * 100 / COUNT(T1.zip_code) FROM country AS T1 INNER JOIN zip_data AS T2 ON T1.zip_code = T2.zip_code