Answered step by step
Verified Expert Solution
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 Exercise
In Week & 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. JOB HISTORY
PF
EMPLOYEEID
NUMBER
P
STARTDATE
DATE
ENDDATE
DAIE
F JOBLID
VARCHAR BYTE
DEPARTMENTID
NUMBER
JHISTEMPIDSTDATEPK EMPLOYEEID STARTDATE
OZJHISTDEPTFK DEPARTMENTID
JHISTEMPFK EMPLOYEEID
JHISTJOBFK JOBID
JHISTDEPARTMENTIX DEPARTMENTID
JHISTEMPLOYEEIX EMPLOYEEID
JHISTEMPIDSTDATEPK EMPLOYEEID STARTDATE
JHISTJOBIX JOBID
DEPARTMENTS
"DEPARTMENTID
NUMBER
DEPARTMENTNAME
VARCHAR BYTE
MANAGERID
NUMBER
LOCATIONID
NUMBER
DEPTIDPK DEPARTMENTID
DEPTLOCFK LOCATIONID
DEPTMGRFK MANAGERID
DEPTIDPK DEPARTMENTID
DEPT LOCATION IXLOCATION ID
LOCATIONS
P LOCATION ID
NUMBER
STREETADDRESS VARCHAR BYTE
POSTALCODE
VARCHAR BYTE
CITY
VARCHAR BYTE
STATEPROVINCE
VARCHAR BYTE
COUNTRYID
CHAR BYTE
LOCIDPK LOCATIONID
deg LOCCIDFK COUNTRYID
LOCCITYIX CITY
LOCCOUNTRYIX COUNTRYID
LOCIDPK LOCATIONID
LOCSTATEPROVINCEIX STATEPROVINCE
P COUNTRY ID
COUNTRY NAME
REGION ID
COUNTRIES
CHAR BYTE
VARCHAR BYTE
NUMBER
COUNTRYCIDPKCOUNTRYID
COUNTRREGFK REGIONID
ZJOBS
P JOBLID
VARCHAR BYTE
JOBTITLE
VARCHAR BYTE
MINSALARY NUMBER
MAX SALARY NUMBER
JOBIDPK JOBID
JOBIDPK JOBID
EMPLOYEES
"EMPLOYEEID
NUMBER
FIRSTNAME
VARCHAR BYTE
LASTNAME
VARCHAR BYTE
U EMAIL
VARCHAR BYTE
PHONE NUMBER
VARCHAR BYTE
HIREDATE
DATE
F JOB ID
VARCHAR BYTE
SALARY
NUMBER
COMMISSIONPCT
NUMBER
MANAGER ID
NUMBER
DEPARTMENTID
NUMBER
EMPEMAILUK EMAIL
EMPEMPIDPK EMPLOYEEID
EMPDEPTFK DEPARTMENTID
EMPJOBFK JOBID
EMPMANAGERFK MANAGERID
EMPDEPARTMENTIX DEPARTMENTID
EMPEMAILUK EMAIL
EMPEMPIDPK EMPLOYEEID
EMPJOBIX JOBID
EMPMANAGERIX MANAGERID
EMPNAME IX LASTNAME, FIRSTNAME
REGIONS
P REGIONID
NUMBER
REGION NAME
VARCHAR BYTE
REG IDPKREGIONID
REGIDPK REGION ID star schema: employeesdimension departmentsdimension
employeekey departmentkey
firstname departmentname
lastname
currentempflag
empfact
employeekey
departmentkey
locationkey
jobkey
positionkey
salary
jobsdimension commissionpct locationsdimension
jobkey locationkey
jobtitle postalcode
currentjobflag city
stateprovince
regionid
regionname
countryid
countrynameDanielle 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 for the New Jeans HR database.
a You might want to improve and update your star schema from Week
Otherwise, you can leave it if you think that is the best schema you produced.
b The ERDtables 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 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 currentempflag column in the
dwhremployeesdimension table. If an employee has retired or resigned, then
currentempflag column becomes NNo 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 currentempflag, in the SQL code, add another line in the select
statement for employeesCREATE TABLE DAHR EMPLOYEES DIMENSION AS
SELECT employeeid
as employee
key,
firstname,
lastname,
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 jobhistory and employees tables together to form a fact table
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