Question: SQL List all zip codes along with a column that classifies their gender distribution in 2018. To calculate the distribution, take the female population and

SQL

List all zip codes along with a column that classifies their gender distribution in 2018. To calculate the distribution, take the female population and divide by the total population. Then, for the classification, if the % female is greater than 60%, call it "predominantly female". If it is below 40%, call it "predominantly male." For everything else, input "evenly distributed". (As a hint, include a new field that calculates the gender distribution, and then use that field in your CASE statement.) In the results, include the zip code, gender distribution (%), and the gender distribution classification. Finally, only include zip codes with a total population of at least 1000 people and sort by the zip code in ascending order.

FROM CENSUS_BY_ZIP_CODE

SQL List all zip codes along with a column that classifies their

ZIP_CODE VARCHAR (5) NOT NULL, REPORTING_YEAR NUMBER (38,), HOUSEHOLDS NUMBER (38,0), POPULATION_TOTAL NUMBER (38,0), POPULATION_MALE NUMBER (38,0), POPULATION_FEMALE NUMBER (38,0), MEDIAN_AGE NUMBER (3,1), HOUSING_UNITS_TOTAL NUMBER(38,0), HOUSING_UNITS_OCCUPIED NUMBER (38,0)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!