Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What federal statute governs working hours and wages?

Answered: 1 week ago

Question

What are the w 3 c standards for css

Answered: 1 week ago