-- Database schema
| Demog : GEOID [ INTEGER ] primary_key , INHABITANTS_K [ REAL ] , INCOME_K [ REAL ] , A_VAR1 [ REAL ] , A_VAR2 [ REAL ] , A_VAR3 [ REAL ] , A_VAR4 [ REAL ] , A_VAR5 [ REAL ] , A_VAR6 [ REAL ] , A_VAR7 [ REAL ] , A_VAR8 [ REAL ] , A_VAR9 [ REAL ] , A_VAR10 [ REAL ] , A_VAR11 [ REAL ] , A_VAR12 [ REAL ] , A_VAR13 [ REAL ] , A_VAR14 [ REAL ] , A_VAR15 [ REAL ] , A_VAR16 [ REAL ] , A_VAR17 [ REAL ] , A_VAR18 [ REAL ] | mailings3 : REFID [ INTEGER ] primary_key , REF_DATE [ DATETIME ] , RESPONSE [ TEXT ] | Customers : ID [ INTEGER ] primary_key , SEX [ TEXT ] , MARITAL_STATUS [ TEXT ] , GEOID [ INTEGER ] , EDUCATIONNUM [ INTEGER ] , OCCUPATION [ TEXT ] , age [ INTEGER ] | Mailings1_2 : REFID [ INTEGER ] primary_key , REF_DATE [ DATETIME ] , RESPONSE [ TEXT ] | Sales : EVENTID [ INTEGER ] primary_key , REFID [ INTEGER ] , EVENT_DATE [ DATETIME ] , AMOUNT [ REAL ] |
-- -- In male customers ages from 30 to 50, how many of them has an income ranges from 2000 to 2300?

SELECT COUNT(T1.ID) FROM Customers AS T1 INNER JOIN Demog AS T2 ON T1.GEOID = T2.GEOID WHERE T1.SEX = 'Male' AND T1.age >= 30 AND T1.age <= 50 AND T2.INCOME_K >= 2000 AND T2.INCOME_K <= 2300;