Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Week 0 3 - Exercise In Week 1 & 2 , we introduced the fast growing fashion store, New Jeans! New Jeans originally engaged CwP

Week 03- Exercise
In Week 1 & 2, we introduced the fast growing fashion store, New Jeans! New Jeans
originally engaged CwP Consulting to help assist them in transforming their data structures.
The scope of the work included improving the HR database reporting. YE Consulting
(yourself) has created a star schema which we can use for this weeks exercise. The sample
ERD has been attached below for your reference as well. 25209731.JOB HISTORY
PF*|
EMPLOYEE_ID
NUMBER (6)
P.
START_DATE
DATE
* END_DATE
DAIE
F " JOBLID
VARCHAR2(10 BYTE)
DEPARTMENT_ID
NUMBER (4)
JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID, START_DATE)
OZJHIST_DEPT_FK (DEPARTMENT_ID)
JHIST_EMP_FK (EMPLOYEE_ID)
3JHIST_JOB_FK (JOB_ID)
JHIST_DEPARTMENT_IX (DEPARTMENT_ID)
JHIST_EMPLOYEE_IX (EMPLOYEE_ID)
JHIST_EMP_ID_ST_DATE_PK (EMPLOYEE_ID, START_DATE)
JHIST_JOB_IX (JOB_ID)
25209731.DEPARTMENTS
"DEPARTMENT_ID
NUMBER (4)
* DEPARTMENT_NAME
VARCHAR2(30 BYTE)
MANAGER_ID
NUMBER (6)
LOCATION_ID
NUMBER (4)
- DEPT_ID_PK (DEPARTMENT_ID)
3 DEPT_LOC_FK (LOCATION_ID)
3 DEPT_MGR_FK (MANAGER_ID)
DEPT_ID_PK (DEPARTMENT_ID)
DEPT LOCATION IX.(LOCATION ID
25209731.LOCATIONS
P * LOCATION ID
NUMBER (4)
STREET_ADDRESS VARCHAR2(40 BYTE)
POSTAL_CODE
VARCHAR2(12 BYTE)|
* CITY
VARCHAR2(30 BYTE)
STATE_PROVINCE
VARCHAR2(25 BYTE)
COUNTRY_ID
CHAR (2 BYTE)
LOC_ID_PK (LOCATION_ID)
\deg LOC_C_ID_FK (COUNTRY_ID)
LOC_CITY_IX (CITY)
LOC_COUNTRY_IX (COUNTRY_ID)
LOC_ID_PK (LOCATION_ID)
LOC_STATE_PROVINCE_IX (STATE_PROVINCE)
P * COUNTRY ID
COUNTRY NAME
REGION ID
25209731.COUNTRIES
CHAR (2 BYTE)
VARCHAR2(40 BYTE)
NUMBER
-> COUNTRY_C_ID_PK(COUNTRY_ID)
* COUNTR_REG_FK (REGION_ID)
Z5209731.JOBS
P ^ JOBLID
VARCHAR2(10 BYTE)
* JOB_TITLE
VARCHAR2(35 BYTE)
MIN_SALARY NUMBER (6)
MAX_ SALARY NUMBER (6)
JOB_ID_PK (JOB_ID)
JOB_ID_PK (JOB_ID)
25209731.EMPLOYEES
"EMPLOYEE_ID
NUMBER (8)
FIRST_NAME
VARCHAR2(20 BYTE)
* LAST_NAME
VARCHAR2(25 BYTE)
U - EMAIL
VARCHAR2(25 BYTE)
PHONE NUMBER
VARCHAR2(20 BYTE)
* HIRE_DATE
DATE
F * JOB ID
VARCHAR2(10 BYTE)
SALARY
NUMBER (8,2)
COMMISSION_PCT
NUMBER (2,2)
MANAGER ID
NUMBER (6)
DEPARTMENT_ID
NUMBER (4)
EMP_EMAIL_UK (EMAIL)
EMP_EMP_ID_PK (EMPLOYEE_ID)
3 EMP_DEPT_FK (DEPARTMENT_ID)
3 EMP_JOB_FK (JOB_ID)
3 EMP_MANAGER_FK (MANAGER_ID)
EMP_DEPARTMENT_IX (DEPARTMENT_ID)
EMP_EMAIL_UK (EMAIL)
EMP_EMP_ID_PK (EMPLOYEE_ID)
EMP_JOB_IX (JOB_ID)
EMP_MANAGER_IX (MANAGER_ID)
EMP_NAME_ IX (LAST_NAME, FIRST_NAME)
25209731 REGIONS
P * REGION_ID
NUMBER
REGION NAME
VARCHAR2(25 BYTE)
-> REG _ID_PK(REGION_ID)
REG_ID_PK (REGION ID)| star schema: employees_dimension departments_dimension
employee_key department_key
first_name department_name
last_name
current_emp_flag
empfact
employee_key
department_key
location_key
job_key
position_key
salary
jobs_dimension commission_pct locations_dimension
job_key location_key
job_title postal_code
current_job_flag city
state_province
region_id
region_name
country_id
country_nameDanielle was pleased with your results for the New Jeans fashion store DW and wants you to
have a go for the New Jeans HR database! This exercise is based on the Star Schema created
in Week 02 for the New Jeans HR database.
(a) You might want to improve and update your star schema from Week 02.
Otherwise, you can leave it if you think that is the best schema you produced.
(b) The ERD/tables for the HR Database are in the Oracle SQL Developer AWS
server already Jobs, Job History, Employees etc NOT ZJLB
(c) Write SQL statements to create the necessary dimension tables and a fact table
(for all the names for table and views, make sure they start with dwhr_) based
on the schema in (a). Step 3-7 of Star Schema creation
(d) Write SQL statements to populate data from the HR Database Example
provided in New Jeans Star Schema and Laksa Delight sample
Note: you can combine (b) and (c) together to create tables and populate the tables
at the same time. You just have to make sure you add data to the dimension tables
first before the fact table, otherwise you will violate the constraints on the fact
table.
(e) There are a number of ways to create dimension tables and a fact table. For this
exercise, it is recommended to create a current_emp_flag column in the
dwhr_employees_dimension table. If an employee has retired or resigned, then
current_emp_flag column becomes N(No), otherwise the column should be Y
(Yes).
o When denormalising tables, join them together in SQL. The New Jeans
star schema provides an example of this.
o For current_emp_flag, in the SQL code, add another line in the select
statement for employeesCREATE TABLE DAHR EMPLOYEES DIMENSION AS
(SELECT employee_id
as employee
key,
first_name,
last_name,
"y"
as current
_emp
FROM EMPLOYEES);(f) How do you populate the data for the fact table? The challenge here is how can
you put job_history and employees tables together to form a fact table

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

More Books

Students also viewed these Databases questions

Question

Revenue at 3 0 0 units ? refer image

Answered: 1 week ago

Question

Does it avoid using personal pronouns (such as I and me)?

Answered: 1 week ago

Question

Does it clearly identify what you have done and accomplished?

Answered: 1 week ago