Question
The following database project will create an educational attainment demand forecast for the state of California for years greater than 2010. The demand forecast is
The following database project will create an educational attainment demand forecast for the state of California for years greater than 2010. The demand forecast is the expected number of population who have obtained a certain level of education. The population is divided into age groups and education attainment is divided into different levels. The population of each group is estimated for each year up to year 2050. Implement the following steps to obtain and educational demand forecast for the state of California. The files can be downloaded below.
- Create a ca_pop schema in your MySQL database.
- Using your ca_pop schema, create an educational_attainment table which columns match the columns in the Excel spreadsheet ca_pop_educational_attainment.csv.
- Using your ca_pop schema, create a pop_proj table which columns match the columns in the Excel spreadsheet pop_proj_1970_2050.csv.
- Using the data loading technique for a csv file you learned in Module 1, load the data in ca_pop_educational_attainment.csv into the table educational_attainment.
- Using the data loading technique for a csv file you learned in Module 1, load the data in pop_proj_1970_2050.csv into the table pop_proj.
- Write a query to select the total population in each age group.
- Use the query from Step 6 as a subquery to find each type of education attained by the population in that age group and the fraction of the population of that age group that has that educational attainment. Label the fraction column output as coefficient.For instance, the fraction of the population in age group 00 - 17 who has an education attainment of Bachelor's degree or higher is 0.0015, which is the coefficient.
- Create a demographics table from the SQL query from Step 7.
- Create a query on the pop_proj table which shows the population count by date_year and age.
- Use that query from Step 9 as a subquery and join it to the demographics table using the following case statement:
-
demographics.age = case when temp_pop.age < 18 then '00 to 17' when temp_pop.age > 64 then '65 to 80+' else '18 to 64' end
temp_pop is an alias for the subquery. Use the following calculation for the demand output:
round(sum(temp_pop.total_pop * demographics.coefficient)) as demand
Output the demand grouped by year and education level
THE BELOW TABLES ARE PORTIONS OF THE CSV FILE FOR QUESTION 3 AND 4. UNABLE TO UPLOAD THE ENTIRE FILES
ca pop educational attainment table
Year | Age | Gender | Educational Attainment | Personal Income | Population Count |
1/1/2008 0:00 | 00 to 17 | Male | Children under 15 | No Income | |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | No Income | 650889 |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | $5,000 to $9,999 | 30152 |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | $10,000 to $14,999 | 7092 |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | $15,000 to $24,999 | 3974 |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | $25,000 to $34,999 | 2606 |
1/1/2008 0:00 | 00 to 17 | Male | No high school diploma | $35,000 to $49,999 | 2227 |
1/1/2008 0:00 | 00 to 17 | Male | High school or equivalent | No Income |
pop_proj table
fips | county | year | age | pop_female | pop_male | pop_total |
6001 | ALAMEDA | 1970 | 0 | 8533 | 8671 | 17204 |
6001 | ALAMEDA | 1970 | 1 | 8151 | 8252 | 16403 |
6001 | ALAMEDA | 1970 | 2 | 7753 | 8015 | 15768 |
6001 | ALAMEDA | 1970 | 3 | 8018 | 8412 | 16430 |
6001 | ALAMEDA | 1970 | 4 | 8551 | 8648 | 17199 |
6001 | ALAMEDA | 1970 | 5 | 9012 | 9208 | 18220 |
6001 | ALAMEDA | 1970 | 6 | 9637 | 9636 | 19273 |
6001 | ALAMEDA | 1970 | 7 | 9561 | 9713 | 19274 |
6001 | ALAMEDA | 1970 | 8 | 9648 | 10008 | 19656 |
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started