Database schema:

CREATE TABLE "Customers" (
	"ID" INTEGER -- example: ['0', '1'],
	"SEX" TEXT -- example: ['Male', 'Female'],
	"MARITAL_STATUS" TEXT -- example: ['Married-civ-spouse', 'Never-married'],
	"GEOID" INTEGER -- example: ['61', '70'],
	"EDUCATIONNUM" INTEGER -- example: ['7', '3'],
	"OCCUPATION" TEXT -- example: ['Machine-op-inspct', 'Handlers-cleaners'],
	age INTEGER -- example: ['78', '62'],
	PRIMARY KEY ("ID"), 
	CONSTRAINT fk_customers_demog FOREIGN KEY("GEOID") REFERENCES "Demog" ("GEOID")
)


CREATE TABLE "Demog" (
	"GEOID" INTEGER -- example: ['0', '1'],
	"INHABITANTS_K" REAL -- example: ['36.25', '30.046'],
	"INCOME_K" REAL -- example: ['3012.75', '2631.47'],
	"A_VAR1" REAL -- example: ['6.084', '4.604'],
	"A_VAR2" REAL -- example: ['5.79', '8.309'],
	"A_VAR3" REAL -- example: ['6.007', '8.595'],
	"A_VAR4" REAL -- example: ['5.938', '3.935'],
	"A_VAR5" REAL -- example: ['8.773', '6.362'],
	"A_VAR6" REAL -- example: ['3.579', '8.626'],
	"A_VAR7" REAL -- example: ['4.624', '6.349'],
	"A_VAR8" REAL -- example: ['8.324', '4.694'],
	"A_VAR9" REAL -- example: ['6.884', '5.233'],
	"A_VAR10" REAL -- example: ['7.062', '6.232'],
	"A_VAR11" REAL -- example: ['5.205', '7.319'],
	"A_VAR12" REAL -- example: ['8.231', '3.72'],
	"A_VAR13" REAL -- example: ['6.405', '6.746'],
	"A_VAR14" REAL -- example: ['7.202', '8.679'],
	"A_VAR15" REAL -- example: ['5.292', '4.932'],
	"A_VAR16" REAL -- example: ['7.969', '3.5'],
	"A_VAR17" REAL -- example: ['5.512', '8.15'],
	"A_VAR18" REAL -- example: ['5.633', '5.783'],
	PRIMARY KEY ("GEOID")
)


CREATE TABLE "Mailings1_2" (
	"REFID" INTEGER -- example: ['0', '1'],
	"REF_DATE" DATETIME -- example: ['2007-02-01 12:00:00', '2007-03-01 12:00:00'],
	"RESPONSE" TEXT -- example: ['false', 'true'],
	PRIMARY KEY ("REFID"), 
	CONSTRAINT fk_mailings1_2_customers FOREIGN KEY("REFID") REFERENCES "Customers" ("ID")
)


CREATE TABLE "Sales" (
	"EVENTID" INTEGER -- example: ['0', '1'],
	"REFID" INTEGER -- example: ['0', '1'],
	"EVENT_DATE" DATETIME -- example: ['2006-12-25 12:00:00', '2006-12-21 12:00:00'],
	"AMOUNT" REAL -- example: ['17.401', '17.907'],
	PRIMARY KEY ("EVENTID"), 
	CONSTRAINT fk_sales_customers FOREIGN KEY("REFID") REFERENCES "Customers" ("ID")
)


CREATE TABLE mailings3 (
	"REFID" INTEGER -- example: ['60000', '60001'],
	"REF_DATE" DATETIME -- example: ['2007-07-01 12:00:00'],
	"RESPONSE" TEXT -- example: ['false', 'true'],
	PRIMARY KEY ("REFID")
)

Question: Among the customers from a place with more than 20,000 and less than 30,000 inhabitants, how many of them are Machine-op-inspcts?
Evidence: place with more than 20,000 and less than 30,000 inhabitants refers to GEOID where INHABITANTS_K BETWEEN 20 AND 30; OCCUPATION = 'Machine-op-inspct';

SQL:
SELECT COUNT(T1.GEOID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.OCCUPATION = 'Machine-op-inspct' AND T2.INHABITANTS_K > 20 AND T2.INHABITANTS_K < 30