SlideShare a Scribd company logo
Database Systems
Introduction to Databases and Data Warehouses
(Solutions to end-of-chapter exercises E8.1, E8.2, E8.3)
E8.1 ZAGI Retail Company
Consider the following, slightly modified, ZAGI Retail Company
scenario. The ZAGI Retail Company wants to create analytical database
to analyze sales.
The three available data sources are:
• Source 1 The ZAGI Retail Company Sales Department Database, as
shown below)
• Source 2 The ZAGI Retail Company Facilities Department Database
shown below
• Source 3 A Customer Demographic Data external table shown below.
Source 1: ZAGI Sales Department
Source 2: ZAGI Facilities Department
Source 3: Customer Demographic external
table
E8.1 ZAGI Retail Company data warehouse
The data warehouse has to enable an analysis of sales dollar amounts and
quantities by
• date, including: full date, day of week, day of month, month quarter, year
• time
• product, including: product name and price, product category, product
vendor
• customer, including: customer name, zip, gender, marital status, education
level, credit score
• store, including: individual store, store size and store zip, store checkout
system, store layout, store region.
ZAGI Sales Dimensional DW model
(star schema)
INSERT INTO Statements
INSERT INTO ZAGI_Dimensional.CALENDAR_D (FullDate, DayOfWeek, DayOfMonth, Month, Qtr,
Year ) SELECT DISTINCT TDate as FullDate, DAYOFWEEK(tdate) AS DayOfWeek,
dayofmonth(tdate) AS DayOfMonth, month(tdate) AS Month, quarter(tdate) AS Qtr, year(tdate) AS
Year FROM SALESTRANSACTION;
INSERT INTO ZAGI_Dimensional.PRODUCT_D (ProductID, ProductName, ProductPrice,
ProductVendorName, ProductCategoryName ) SELECT p.ProductID as ProductID,
p.ProductName, p.ProductPrice, v.VendorName AS ProductVendorName, c.CategoryName AS
ProductCategoryName FROM PRODUCT p, VENDOR v, CATEGORY c WHERE p.VendorID =
v.VendorID AND p.CategoryID = c.CategoryID GROUP BY p.ProductID;
INSERT INTO ZAGI_Dimensional.STORE_D (StoreID, StoreZip, StoreRegionName, StoreSize,
StoreCSystem, StoreLayout ) SELECT s.StoreID as StoreId, s.StoreZip AS StoreZip, r.RegionName
AS StoreRegionName, s1.StoreSize AS StoreSize, cs.CSystem AS StoreCSystem, l.Layout AS
StoreLayout FROM ZAGI_Sales_Dep.STORE s, ZAGI_Sales_Dep.REGION r,
ZAGI_Facilities_Dep.STORE1 s1, ZAGI_Facilities_Dep.CHECKOUTSYSTEM cs,
ZAGI_Facilities_Dep.LAYOUT l WHERE r.RegionID = s.RegionID AND s.StoreID=s1.StoreID AND
s1.CSID = cs.CSID AND s1.LTID = l.LayoutID GROUP BY s.StoreID;
INSERT INTO ZAGI_Dimensional.CUSTOMER_D(CustomerID, CustomerName, CustomerZip,
CustomerGender, CustomerMaritalStatus, CustomerEducationLevel, CustomerCreditScore )SELECT
t1.customerid as CustomerId, t1.customername AS CustomerName, t1.customerzip AS CustomerZip,
t2.gender AS CustomerGender, t2.maritalstatus AS CustomerMaritalStatus, t2.educationlevel AS
CustomerEducationLevel, t2.creditscore AS CustomerCreditScore FROM
ZAGI_Sales_Dep.CUSTOMER AS t1, ZAGI_Customer_Table.CUSTOMER_TABLE AS t2 WHERE
t1.CustomerID = t2.CustomerID;
CREATE VIEW `SALES_FACT_VIEW` AS SELECT st.TDate, st.StoreID, sv.ProductID,
st.CustomerID, sv.TID AS TID, st.TTime AS TimeOfDay, p.ProductPrice*sv.NoOfItems AS DollarsSold,
sv.NoOfItems AS UnitsSold FROM ZAGI_Sales_Dep.SOLDVIA AS sv, ZAGI_Sales_Dep.PRODUCT
AS p, ZAGI_Sales_Dep.SALESTRANSACTION AS st WHERE sv.ProductID = p.ProductID AND
sv.TID = st.TID;
INSERT INTO ZAGI_Dimensional.SALES_FACT (CalendarKey, StoreKey, ProductKey, CustomerKey,
TID, TimeOfDay, DollarsSold, UnitsSold ) SELECT CA.CalendarKey, S.StoreKey, P.ProductKey,
CU.CustomerKey, SFV.TID, SFV.TimeOfDay, SFV.DollarsSold, SFV.UnitsSold FROM
ZAGI_Sales_Dep.SALES_FACT_VIEW AS SFV, ZAGI_Dimensional.CALENDAR_D AS CA,
ZAGI_Dimensional.PRODUCT_D AS P, ZAGI_Dimensional.STORE_D as S,
ZAGI_Dimensional.CUSTOMER_D AS CU WHERE CA.FullDate = SFV.TDate AND S.StoreID =
SFV.StoreID AND P.ProductID = SFV.ProductID AND CU.CustomerID = SFV.CustomerID;
E8.1b, E8.1c Aggregated Fact Table
A dimensional model above contains an aggregated fact table, which
shows a summary of units sold and dollars sold for daily purchases of
each product in each store. It is populated as shown below.
INSERT INTO ZAGI_Dimensional.AGGREGATED_FACT (CalendarKey, StoreKey,
ProductKey, DollarsSold, UnitsSold)
SELECT SF.CalendarKey, SF.StoreKey, SF.ProductKey, SUM(DollarsSold),
SUM(UnitsSold)
FROM ZAGI_Dimensional.SALES_FACT SF
GROUP BY CalendarKey, StoreKey, ProductKey;
Source 1: ZAGI Sales Department data
Source 2: ZAGI Facilities Department data
Source 3: Customer Demographic data
external table
ZAGI Sales Dimensional DW: fact tables
populated with data, Calendar dimension
ZAGI Sales Dimensional DW: Store, Product and
Customer Dimensions Populated with data
E8.2 City Police Department
Consider the following scenario involving the City Police Department.
The City Police Department wants to create an analytical database to
analyze its ticket revenue.
The two available data sources, Source 1 and Source 2, are described
below.
• Source 1 The City Police Department maintains the Ticketed
Violations Database, shown in Figure below.
• Source 2 The Department of Motor Vehicles (DMV) maintains the
Vehicle Registration Table, shown in Figure below
Source 1: CPD Ticketed Violations
Source 1: CPD Ticketed Violations
Source 2: DMV Vehicle Registration Table
E8.2 Ticket Revenue Data Warehouse
The data warehouse has to enable an analysis of ticket revenues by:
• date, including: full date day of week, day of month, month, quarter, year
• officer, including: officer ID, officer name, officer rank
• payer of the ticket, including: payer DLN, payer name, payer gender, payer
birth year
• vehicle, including: vehicle LPN, vehicle make, vehicle model, vehicle year,
vehicle owner DLN, vehicle owner name, vehicle owner gender, vehicle
owner birth year
• ticket type, including: ticket category (driving or parking), ticket violation,
ticket fee
Ticket Revenue Dimensional DW model
(star schema)
INSERT INTO statements
INSERT INTO CPD_Ticket_Revenue.CALENDAR (FullDate, DayOfWeek, DayOfMonth, Month, Quarter, Year )
SELECT DISTINCT DTDate as FullDate, DAYOFWEEK(DTDate) AS DayOfWeek, dayofmonth(DTDate) AS
DayOfMonth, month(DTDate) AS Month, quarter(DTDate) AS Qtr, year(DTDate) AS Year FROM
CPD_Ticketed_Violations.DRIVINGTICKET UNION SELECT DISTINCT PTDate as FullDate,
DAYOFWEEK(PTDate) AS DayOfWeek, dayofmonth(PTDate) AS DayOfMonth, month(PTDate) AS Month,
quarter(PTDate) AS Quarter, year(PTDate) AS Year FROM CPD_Ticketed_Violations.PARKINGTICKET;
INSERT INTO CPD_Ticket_Revenue.OFFICER (OfficerID, OfficerName, OfficerRank) SELECT OfficerID,
OfficerName, OfficerRank FROM CPD_Ticketed_Violations.OFFICER;
INSERT INTO CPD_Ticket_Revenue.TICKETTYPE (TicketCategory, TicketViolation, TicketFee) SELECT * FROM
CPD_Ticketed_Violations.DTICKETTYPE UNION SELECT * FROM CPD_Ticketed_Violations.PTICKETTYPE;
INSERT INTO CPD_Ticket_Revenue.PAYER (PayerDLN, PayerName, PayerGender, PayerBirthYear)SELECT *
FROM CPD_Ticketed_Violations.DRIVER;
INSERT INTO CPD_Ticket_Revenue.VEHICLE (VehicleLPN, VehicleMake, VehicleModel, VehicleYear,
VehicleOwnerDLN, VehicleOwnerName, VehicleOwnerGender, VehicleOwnerBirthYear) SELECT v1.VehicleLPN,
v2.VehicleMake, v2.VehicleModel, v2.VehicleYear, v2.OwnerDLN, v2.OwnerName, v2.OwnerGender,
OwnerBirthYear FROM CPD_Ticketed_Violations.VEHICLE AS v1, CPD_Vehicle_Registration_Table.VRT AS v2
WHERE v1.VehicleLPN = v2.VehicleLPN;
INSERT INTO CPD_Ticket_Revenue.REVENUE_FACT (CalendarKey, OfficerKey, PayerKey,
VehicleKey, TicketTypeKey, TicketID, Amount)SELECT C.CalendarKey, O.OfficerKey, P.PayerKey,
V.VehicleKey, TT.TicketTypeKey, dt.DTID AS TID, dtt.DTFee AS Amount FROM
CPD_Ticketed_Violations.DRIVINGTICKET dt, CPD_Ticketed_Violations.DTICKETTYPE dtt,
CPD_Ticket_Revenue.CALENDAR as C, CPD_Ticket_Revenue.PAYER as P,
CPD_Ticket_Revenue.VEHICLE as V, CPD_Ticket_Revenue.OFFICER as O,
CPD_Ticket_Revenue.TICKETTYPE AS TT WHERE dt.DTTypeID = dtt.DTTypeID and dt.OfficerID =
O.OfficerID and dt.DLN = P.PayerDLN and dt.VehicleLPN = V.VehicleLPN and dt.DTTypeID =
TT.TicketCategory and C.FullDate = dt.DTDateGROUP BY TID UNION SELECT C.CalendarKey,
O.OfficerKey, P.PayerKey, V.VehicleKey, TT.TicketTypeKey, pt.PTID AS TID, ptt.DTFee AS Amount
FROM CPD_Ticketed_Violations.PARKINGTICKET pt, CPD_Vehicle_Registration_Table.VRT vr,
CPD_Ticketed_Violations.PTICKETTYPE ptt, CPD_Ticket_Revenue.CALENDAR as C,
CPD_Ticket_Revenue.PAYER as P, CPD_Ticket_Revenue.VEHICLE as V,
CPD_Ticket_Revenue.OFFICER as O, CPD_Ticket_Revenue.TICKETTYPE AS TT WHERE
pt.PTTypeID = ptt.PTTypeID and pt.OfficerID = O.OfficerID and vr.OwnerDLN = P.PayerDLN and
pt.VehicleLPN = V.VehicleLPN and pt.PTTypeID = TT.TicketCategory and C.FullDate =
pt.PTDateGROUP BY TID;
E8.2b,c Aggregated fact table
A dimensional model above contains an aggregated fact table, which
shows a summary of daily revenue amount for each officer. It is
populated as shown below.
INSERT INTO CPD_Ticket_Revenue.REV_OFFICER_BY_DAY (CalendarKey,
OfficerKey, Revenue)
SELECT CalendarKey, OfficerKey, SUM(Amount)
FROM CPD_Ticket_Revenue.REVENUE_FACT
GROUP BY CalendarKey, OfficerKey;
Sources 1: CPD Ticketed Violations data
Source 2: DMV Vehicle Registration table
Ticket Revenue DW: Fact Tables populated
with data, Calendar dimension
Ticket Revenue DW: Payer, Vehicle, Officer and
TicketType Dimensions Populated with Data
E8.3 Big Z Inc. Automotive Products
Consider the following scenario involving Big Z Inc., an automotive
products wholesaler analytical database Big Z Inc. wants to create the
(data warehouse) to analyze its order quantities. The two available data
sources, Source 1 and Source 2, are described below.
The three available data sources are:
• Source 1 The Big Z Inc. Human Resources Department Table, shown
below.
• Source 2 The Big Z Inc. Orders Database, shown in Figure bellow.
Source 1: HR Department table
Source 2: Big Z Orders database
E8.3 Dimensional Warehouse
The data warehouse has to enable an analysis of order quantities by:
• date, including: full date, day of week, day of month, month, quarter, year
• time
• product, including product ID, product name, product type, product supplier
name
• customer, including: customer ID, customer name, customer type, customer zip
• depot, including depot ID, depot size, depot zip
• order clerk, including: order clerk id, order clerk name, order clerk title, order
clerk education level, order clerk year of hire
Based on the sources and requirements listed above, create a dimensional model
that will be used for the dimensionally modeled data warehouse for Big Z Inc.
Big Z Order Quantities Dimensional DW model
(star schema)
Big Z Orders Quantities Normalized schema
E8.3 INSERT INTO Statements
INSERT INTO BigZ_Dimensional.CALENDAR (FullDate, DayOfWeek, DayOfMonth,
MONTH, Quarter, YEAR)SELECT DISTINCT OrderDate AS FullDate,
DAYOFWEEK(OrderDate) AS DayOfWeek, dayofmonth(OrderDate) AS DayOfMonth,
month(OrderDate) AS MONTH, quarter(OrderDate) AS Qtr, year(OrderDate) AS YEAR
FROM BigZ_Orders.ORDER_;
INSERT INTO BigZ_Dimensional.CUSTOMER (CustomerID, CustomerName,
CustomerType, CustomerZip) SELECT * FROM BigZ_Orders.CUSTOMER;
INSERT INTO BigZ_Dimensional.DEPOT (DepotID, DepotSize, DepotZip)SELECT * FROM
BigZ_Orders.DEPOT;
INSERT INTO BigZ_Dimensional.ORDERCLERK (OCID, OCName, OCTitle, OCEducation,
OCYofhire) SELECT oc.OCID, oc.OCName, hr.Title, hr.EducationLevel, hr.YearOfHire
FROM BigZ_Orders.ORDERCLERK AS oc, BigZ_HR_Table.HRDEPARTMENT AS hr
WHERE oc.OCID = hr.EmployeeID;
INSERT INTO BigZ_Dimensional.PRODUCT (ProductID, ProductName, ProductType,
SupplierName)SELECT p.ProductID, p.ProductName, p.ProductType,
s.SupplierNameFROM BigZ_Orders.PRODUCT AS p, BigZ_Orders.SUPPLIER AS s
WHERE p.SupplierID = s.SupplierID;
INSERT INTO BigZ_Dimensional.ORDER_QUANTITY_FACT (CalendarKey, CustomerKey, DepotKey,
OrderClerkKey, ProductKey, OrderID, TIME, Quantity) SELECT C.CalendarKey, CU.CustomerKey,
D.DepotKey, OC.OCKey, P.ProductKey, OV.OrderID, O.OrderTime, sum(OV.Quantity) FROM
BigZ_Dimensional.CALENDAR AS C, BigZ_Dimensional.CUSTOMER AS CU,
BigZ_Dimensional.Depot AS D, BigZ_Dimensional.ORDERCLERK AS OC,
BigZ_Dimensional.PRODUCT AS P, BigZ_Orders.ORDER_ AS O, BigZ_Orders.ORDERVIA AS OV
WHERE O.OrderDate = C.FullDate AND O.CustomerID = CU.CustomerID AND O.DepotID =
D.DepotID AND O.OCID = OC.OCID AND OV.ProductID = P.ProductID AND OV.OrderID =
O.OrderIDGROUP BY OV.OrderID, OV.ProductID;
INSERT INTO BigZ_Normalized.ORDERCLERK (OCID, OCName, Title, EducationLevel, YearOfHire)
SELECT HR.EmployeeID as OCID, HR.Name as OCName, HR.Title, HR.EducationLevel,
HR.YearOfHire FROM BigZ_HR_Table.HRDEPARTMENT HR, BigZ_Orders.ORDERCLERK OC
WHERE HR.EmployeeID = OC.OCID;
INSERT INTO BigZ_Normalized.CUSTOMER SELECT *FROM BigZ_Orders.CUSTOMER;
INSERT INTO BigZ_Normalized.DEPOT SELECT *FROM BigZ_Orders.DEPOT;
INSERT INTO BigZ_Normalized.PRODUCT SELECT p.ProductID, p.ProductName, p.ProductType,
s.SupplierName FROM BigZ_Orders.PRODUCT AS p, BigZ_Orders.SUPPLIER AS s WHERE
p.SupplierID = s.SupplierID;
INSERT INTO BigZ_Normalized.ORDER_SELECT * FROM BigZ_Orders.ORDER_;
INSERT INTO BigZ_Normalized.ORDERVIA SELECT * FROM BigZ_Orders.ORDERVIA;
Source 1: HR Department table
Source 2: Big Z Orders Database
E8.3 Dimensional DW: Fact Table populated
with data, Calendar dimension
E8.3 Dimensional DW: Customer, Depot, Order
Clerk and Product dimensions with data
References:
Jukic N., Vrbsky S., Nestorov S. “Database Systems. Introduction to
Databases and Data Warehouses”. Pearson Education Inc., 2014.

More Related Content

What's hot

Healx
HealxHealx
Healx
PPerksi
 
Popping Pitch Deck
Popping Pitch DeckPopping Pitch Deck
Popping Pitch Deck
Sihlesenkosi Majola
 
Customer Clustering For Retail Marketing
Customer Clustering For Retail MarketingCustomer Clustering For Retail Marketing
Customer Clustering For Retail Marketing
Jonathan Sedar
 
Python Developer Roadmap 2023
Python Developer Roadmap 2023Python Developer Roadmap 2023
Python Developer Roadmap 2023
Simplilearn
 
The Ultimate Startup Pitch Deck Template and Example Startup Pitch
The Ultimate Startup Pitch Deck Template and Example Startup PitchThe Ultimate Startup Pitch Deck Template and Example Startup Pitch
The Ultimate Startup Pitch Deck Template and Example Startup Pitch
Silvia Mah PhD, MBA
 
Introduction to Business Data Analytics
Introduction to Business Data AnalyticsIntroduction to Business Data Analytics
Introduction to Business Data Analytics
VadivelM9
 
EY Letter of recommendation
EY Letter of recommendationEY Letter of recommendation
EY Letter of recommendationIvana Mitrovic
 
Erd examples
Erd examplesErd examples
Erd examples
Pramod Redekar
 
Associação de resistores - serie, paralelo e misto
Associação de resistores - serie, paralelo e mistoAssociação de resistores - serie, paralelo e misto
Associação de resistores - serie, paralelo e misto
RafaelRocha658505
 
Data mining in telecommunication industry
Data mining in telecommunication industryData mining in telecommunication industry
Data mining in telecommunication industry
harshu966
 
7 idx monthly statistics juli 2018
7 idx monthly statistics juli 20187 idx monthly statistics juli 2018
7 idx monthly statistics juli 2018
Yusuf Darismah
 
Introduction to Data Warehousing
Introduction to Data WarehousingIntroduction to Data Warehousing
Introduction to Data Warehousing
Jason S
 
Shrug Capital IV - VC Pitch Deck Examples
Shrug Capital IV - VC Pitch Deck ExamplesShrug Capital IV - VC Pitch Deck Examples
Shrug Capital IV - VC Pitch Deck Examples
Pitch Decks
 
Analytics in P&C Insurance
Analytics in P&C InsuranceAnalytics in P&C Insurance
Analytics in P&C Insurance
Gregg Barrett
 
Entity Occurrence Diagrams
Entity Occurrence DiagramsEntity Occurrence Diagrams
Entity Occurrence Diagrams
Forrester High School
 
Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause
Deepam Aggarwal
 
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund RaisingPitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
Shibam Sarbswa 🚀
 
8 idx monthly statistics agustus 2018
8 idx monthly statistics agustus 20188 idx monthly statistics agustus 2018
8 idx monthly statistics agustus 2018
Yusuf Darismah
 
How to Create the Perfect Startup Pitch Deck
How to Create the Perfect Startup Pitch DeckHow to Create the Perfect Startup Pitch Deck
How to Create the Perfect Startup Pitch Deck
Eliott Harfouche
 

What's hot (20)

Healx
HealxHealx
Healx
 
Popping Pitch Deck
Popping Pitch DeckPopping Pitch Deck
Popping Pitch Deck
 
Customer Clustering For Retail Marketing
Customer Clustering For Retail MarketingCustomer Clustering For Retail Marketing
Customer Clustering For Retail Marketing
 
Python Developer Roadmap 2023
Python Developer Roadmap 2023Python Developer Roadmap 2023
Python Developer Roadmap 2023
 
The Ultimate Startup Pitch Deck Template and Example Startup Pitch
The Ultimate Startup Pitch Deck Template and Example Startup PitchThe Ultimate Startup Pitch Deck Template and Example Startup Pitch
The Ultimate Startup Pitch Deck Template and Example Startup Pitch
 
Introduction to Business Data Analytics
Introduction to Business Data AnalyticsIntroduction to Business Data Analytics
Introduction to Business Data Analytics
 
Trigger
TriggerTrigger
Trigger
 
EY Letter of recommendation
EY Letter of recommendationEY Letter of recommendation
EY Letter of recommendation
 
Erd examples
Erd examplesErd examples
Erd examples
 
Associação de resistores - serie, paralelo e misto
Associação de resistores - serie, paralelo e mistoAssociação de resistores - serie, paralelo e misto
Associação de resistores - serie, paralelo e misto
 
Data mining in telecommunication industry
Data mining in telecommunication industryData mining in telecommunication industry
Data mining in telecommunication industry
 
7 idx monthly statistics juli 2018
7 idx monthly statistics juli 20187 idx monthly statistics juli 2018
7 idx monthly statistics juli 2018
 
Introduction to Data Warehousing
Introduction to Data WarehousingIntroduction to Data Warehousing
Introduction to Data Warehousing
 
Shrug Capital IV - VC Pitch Deck Examples
Shrug Capital IV - VC Pitch Deck ExamplesShrug Capital IV - VC Pitch Deck Examples
Shrug Capital IV - VC Pitch Deck Examples
 
Analytics in P&C Insurance
Analytics in P&C InsuranceAnalytics in P&C Insurance
Analytics in P&C Insurance
 
Entity Occurrence Diagrams
Entity Occurrence DiagramsEntity Occurrence Diagrams
Entity Occurrence Diagrams
 
Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause Group By, Having Clause and Order By clause
Group By, Having Clause and Order By clause
 
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund RaisingPitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
Pitch Deck-Format-NinzaBiz.com | investment Deck for Fund Raising
 
8 idx monthly statistics agustus 2018
8 idx monthly statistics agustus 20188 idx monthly statistics agustus 2018
8 idx monthly statistics agustus 2018
 
How to Create the Perfect Startup Pitch Deck
How to Create the Perfect Startup Pitch DeckHow to Create the Perfect Startup Pitch Deck
How to Create the Perfect Startup Pitch Deck
 

Viewers also liked

02 Related Concepts
02 Related Concepts02 Related Concepts
02 Related Concepts
Valerii Klymchuk
 
04 Classification in Data Mining
04 Classification in Data Mining04 Classification in Data Mining
04 Classification in Data Mining
Valerii Klymchuk
 
03 Data Mining Techniques
03 Data Mining Techniques03 Data Mining Techniques
03 Data Mining Techniques
Valerii Klymchuk
 
01 Introduction to Data Mining
01 Introduction to Data Mining01 Introduction to Data Mining
01 Introduction to Data Mining
Valerii Klymchuk
 
05 Clustering in Data Mining
05 Clustering in Data Mining05 Clustering in Data Mining
05 Clustering in Data Mining
Valerii Klymchuk
 
Artificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support ProjectArtificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support Project
Valerii Klymchuk
 
03 Data Representation
03 Data Representation03 Data Representation
03 Data Representation
Valerii Klymchuk
 
State of the Word 2011
State of the Word 2011State of the Word 2011
State of the Word 2011
photomatt
 

Viewers also liked (8)

02 Related Concepts
02 Related Concepts02 Related Concepts
02 Related Concepts
 
04 Classification in Data Mining
04 Classification in Data Mining04 Classification in Data Mining
04 Classification in Data Mining
 
03 Data Mining Techniques
03 Data Mining Techniques03 Data Mining Techniques
03 Data Mining Techniques
 
01 Introduction to Data Mining
01 Introduction to Data Mining01 Introduction to Data Mining
01 Introduction to Data Mining
 
05 Clustering in Data Mining
05 Clustering in Data Mining05 Clustering in Data Mining
05 Clustering in Data Mining
 
Artificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support ProjectArtificial Intelligence for Automated Decision Support Project
Artificial Intelligence for Automated Decision Support Project
 
03 Data Representation
03 Data Representation03 Data Representation
03 Data Representation
 
State of the Word 2011
State of the Word 2011State of the Word 2011
State of the Word 2011
 

Similar to Data Warehouse Project

Smartplex1
Smartplex1Smartplex1
Data visualization for e commerce of jcpenney
Data visualization for e commerce of jcpenneyData visualization for e commerce of jcpenney
Data visualization for e commerce of jcpenney
Trupti Shingala, WAS, CPACC, CPWA, JAWS, CSM
 
Exploiting data quality tools to meet the expectation of strategic business u...
Exploiting data quality tools to meet the expectation of strategic business u...Exploiting data quality tools to meet the expectation of strategic business u...
Exploiting data quality tools to meet the expectation of strategic business u...
Zubair Abbasi
 
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
Rajprakash Dwivedi
 
171846965 projects
171846965 projects171846965 projects
171846965 projects
homeworkping8
 
Tn shaw 107 data warehousing problem set
Tn shaw 107 data warehousing problem setTn shaw 107 data warehousing problem set
Tn shaw 107 data warehousing problem set
TejNarayanShaw2
 
Customer master Data
Customer master DataCustomer master Data
Customer master Data
Gopal Volluri
 
Programming the ExactTarget Marketing Cloud
Programming the ExactTarget Marketing CloudProgramming the ExactTarget Marketing Cloud
Programming the ExactTarget Marketing Cloud
Salesforce Developers
 
ORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdfORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdf
Roberto Capancioni
 
Dip configuration
Dip configurationDip configuration
Dip configuration
KamalRahangdale
 
BigData_HW3_Boris_Menshikov_15613416.pptx
BigData_HW3_Boris_Menshikov_15613416.pptxBigData_HW3_Boris_Menshikov_15613416.pptx
BigData_HW3_Boris_Menshikov_15613416.pptx
MorisMenshen
 
207828627 sap-bootcamp-quiz-sd
207828627 sap-bootcamp-quiz-sd207828627 sap-bootcamp-quiz-sd
207828627 sap-bootcamp-quiz-sd
homeworkping8
 
End to-end machine learning project for beginners
End to-end machine learning project for beginnersEnd to-end machine learning project for beginners
End to-end machine learning project for beginners
Sharath Kumar
 
DW DIMENSN MODELNG
DW DIMENSN MODELNGDW DIMENSN MODELNG
DW DIMENSN MODELNGDivya Tadi
 
Data warehousing
Data warehousingData warehousing
Data warehousing
Ashish Kumar Jena
 
AutoBooom write up-sample or Details
AutoBooom write up-sample or DetailsAutoBooom write up-sample or Details
AutoBooom write up-sample or Details
Rajendra suman
 
PYTHON programming.pptx
PYTHON programming.pptxPYTHON programming.pptx
PYTHON programming.pptx
SoojBonthu
 
Document process v7
Document process v7Document process v7
Document process v7
Bala Kris
 

Similar to Data Warehouse Project (20)

Smartplex1
Smartplex1Smartplex1
Smartplex1
 
Data visualization for e commerce of jcpenney
Data visualization for e commerce of jcpenneyData visualization for e commerce of jcpenney
Data visualization for e commerce of jcpenney
 
Exploiting data quality tools to meet the expectation of strategic business u...
Exploiting data quality tools to meet the expectation of strategic business u...Exploiting data quality tools to meet the expectation of strategic business u...
Exploiting data quality tools to meet the expectation of strategic business u...
 
MSA_8110_Final_Project
MSA_8110_Final_ProjectMSA_8110_Final_Project
MSA_8110_Final_Project
 
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
945 mpp1 chicago_taxi data research_v1_cyy_33w1xtp
 
171846965 projects
171846965 projects171846965 projects
171846965 projects
 
Tn shaw 107 data warehousing problem set
Tn shaw 107 data warehousing problem setTn shaw 107 data warehousing problem set
Tn shaw 107 data warehousing problem set
 
Customer master Data
Customer master DataCustomer master Data
Customer master Data
 
Programming the ExactTarget Marketing Cloud
Programming the ExactTarget Marketing CloudProgramming the ExactTarget Marketing Cloud
Programming the ExactTarget Marketing Cloud
 
ORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdfORACLE_23-03-31_en.pdf
ORACLE_23-03-31_en.pdf
 
FINAL-Review
FINAL-ReviewFINAL-Review
FINAL-Review
 
Dip configuration
Dip configurationDip configuration
Dip configuration
 
BigData_HW3_Boris_Menshikov_15613416.pptx
BigData_HW3_Boris_Menshikov_15613416.pptxBigData_HW3_Boris_Menshikov_15613416.pptx
BigData_HW3_Boris_Menshikov_15613416.pptx
 
207828627 sap-bootcamp-quiz-sd
207828627 sap-bootcamp-quiz-sd207828627 sap-bootcamp-quiz-sd
207828627 sap-bootcamp-quiz-sd
 
End to-end machine learning project for beginners
End to-end machine learning project for beginnersEnd to-end machine learning project for beginners
End to-end machine learning project for beginners
 
DW DIMENSN MODELNG
DW DIMENSN MODELNGDW DIMENSN MODELNG
DW DIMENSN MODELNG
 
Data warehousing
Data warehousingData warehousing
Data warehousing
 
AutoBooom write up-sample or Details
AutoBooom write up-sample or DetailsAutoBooom write up-sample or Details
AutoBooom write up-sample or Details
 
PYTHON programming.pptx
PYTHON programming.pptxPYTHON programming.pptx
PYTHON programming.pptx
 
Document process v7
Document process v7Document process v7
Document process v7
 

More from Valerii Klymchuk

Sample presentation slides template
Sample presentation slides templateSample presentation slides template
Sample presentation slides template
Valerii Klymchuk
 
Toronto Capstone
Toronto CapstoneToronto Capstone
Toronto Capstone
Valerii Klymchuk
 
05 Scalar Visualization
05 Scalar Visualization05 Scalar Visualization
05 Scalar Visualization
Valerii Klymchuk
 
06 Vector Visualization
06 Vector Visualization06 Vector Visualization
06 Vector Visualization
Valerii Klymchuk
 
07 Tensor Visualization
07 Tensor Visualization07 Tensor Visualization
07 Tensor Visualization
Valerii Klymchuk
 
Crime Analysis based on Historical and Transportation Data
Crime Analysis based on Historical and Transportation DataCrime Analysis based on Historical and Transportation Data
Crime Analysis based on Historical and Transportation Data
Valerii Klymchuk
 

More from Valerii Klymchuk (6)

Sample presentation slides template
Sample presentation slides templateSample presentation slides template
Sample presentation slides template
 
Toronto Capstone
Toronto CapstoneToronto Capstone
Toronto Capstone
 
05 Scalar Visualization
05 Scalar Visualization05 Scalar Visualization
05 Scalar Visualization
 
06 Vector Visualization
06 Vector Visualization06 Vector Visualization
06 Vector Visualization
 
07 Tensor Visualization
07 Tensor Visualization07 Tensor Visualization
07 Tensor Visualization
 
Crime Analysis based on Historical and Transportation Data
Crime Analysis based on Historical and Transportation DataCrime Analysis based on Historical and Transportation Data
Crime Analysis based on Historical and Transportation Data
 

Recently uploaded

做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
axoqas
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
MaleehaSheikh2
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
mbawufebxi
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
oz8q3jxlp
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Linda486226
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
Tiktokethiodaily
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
Opendatabay
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
vcaxypu
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
ewymefz
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Boston Institute of Analytics
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
ewymefz
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
vcaxypu
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
nscud
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
ahzuo
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
ewymefz
 

Recently uploaded (20)

做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
做(mqu毕业证书)麦考瑞大学毕业证硕士文凭证书学费发票原版一模一样
 
Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
FP Growth Algorithm and its Applications
FP Growth Algorithm and its ApplicationsFP Growth Algorithm and its Applications
FP Growth Algorithm and its Applications
 
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
一比一原版(Bradford毕业证书)布拉德福德大学毕业证如何办理
 
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
一比一原版(Deakin毕业证书)迪肯大学毕业证如何办理
 
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdfSample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
Sample_Global Non-invasive Prenatal Testing (NIPT) Market, 2019-2030.pdf
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
1.Seydhcuxhxyxhccuuxuxyxyxmisolids 2019.pptx
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单一比一原版(BU毕业证)波士顿大学毕业证成绩单
一比一原版(BU毕业证)波士顿大学毕业证成绩单
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
一比一原版(ArtEZ毕业证)ArtEZ艺术学院毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
一比一原版(CBU毕业证)卡普顿大学毕业证成绩单
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
一比一原版(UIUC毕业证)伊利诺伊大学|厄巴纳-香槟分校毕业证如何办理
 
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
一比一原版(IIT毕业证)伊利诺伊理工大学毕业证成绩单
 

Data Warehouse Project

  • 1. Database Systems Introduction to Databases and Data Warehouses (Solutions to end-of-chapter exercises E8.1, E8.2, E8.3)
  • 2. E8.1 ZAGI Retail Company Consider the following, slightly modified, ZAGI Retail Company scenario. The ZAGI Retail Company wants to create analytical database to analyze sales. The three available data sources are: • Source 1 The ZAGI Retail Company Sales Department Database, as shown below) • Source 2 The ZAGI Retail Company Facilities Department Database shown below • Source 3 A Customer Demographic Data external table shown below.
  • 3. Source 1: ZAGI Sales Department
  • 4. Source 2: ZAGI Facilities Department
  • 5. Source 3: Customer Demographic external table
  • 6. E8.1 ZAGI Retail Company data warehouse The data warehouse has to enable an analysis of sales dollar amounts and quantities by • date, including: full date, day of week, day of month, month quarter, year • time • product, including: product name and price, product category, product vendor • customer, including: customer name, zip, gender, marital status, education level, credit score • store, including: individual store, store size and store zip, store checkout system, store layout, store region.
  • 7. ZAGI Sales Dimensional DW model (star schema)
  • 8. INSERT INTO Statements INSERT INTO ZAGI_Dimensional.CALENDAR_D (FullDate, DayOfWeek, DayOfMonth, Month, Qtr, Year ) SELECT DISTINCT TDate as FullDate, DAYOFWEEK(tdate) AS DayOfWeek, dayofmonth(tdate) AS DayOfMonth, month(tdate) AS Month, quarter(tdate) AS Qtr, year(tdate) AS Year FROM SALESTRANSACTION; INSERT INTO ZAGI_Dimensional.PRODUCT_D (ProductID, ProductName, ProductPrice, ProductVendorName, ProductCategoryName ) SELECT p.ProductID as ProductID, p.ProductName, p.ProductPrice, v.VendorName AS ProductVendorName, c.CategoryName AS ProductCategoryName FROM PRODUCT p, VENDOR v, CATEGORY c WHERE p.VendorID = v.VendorID AND p.CategoryID = c.CategoryID GROUP BY p.ProductID; INSERT INTO ZAGI_Dimensional.STORE_D (StoreID, StoreZip, StoreRegionName, StoreSize, StoreCSystem, StoreLayout ) SELECT s.StoreID as StoreId, s.StoreZip AS StoreZip, r.RegionName AS StoreRegionName, s1.StoreSize AS StoreSize, cs.CSystem AS StoreCSystem, l.Layout AS StoreLayout FROM ZAGI_Sales_Dep.STORE s, ZAGI_Sales_Dep.REGION r, ZAGI_Facilities_Dep.STORE1 s1, ZAGI_Facilities_Dep.CHECKOUTSYSTEM cs, ZAGI_Facilities_Dep.LAYOUT l WHERE r.RegionID = s.RegionID AND s.StoreID=s1.StoreID AND s1.CSID = cs.CSID AND s1.LTID = l.LayoutID GROUP BY s.StoreID;
  • 9. INSERT INTO ZAGI_Dimensional.CUSTOMER_D(CustomerID, CustomerName, CustomerZip, CustomerGender, CustomerMaritalStatus, CustomerEducationLevel, CustomerCreditScore )SELECT t1.customerid as CustomerId, t1.customername AS CustomerName, t1.customerzip AS CustomerZip, t2.gender AS CustomerGender, t2.maritalstatus AS CustomerMaritalStatus, t2.educationlevel AS CustomerEducationLevel, t2.creditscore AS CustomerCreditScore FROM ZAGI_Sales_Dep.CUSTOMER AS t1, ZAGI_Customer_Table.CUSTOMER_TABLE AS t2 WHERE t1.CustomerID = t2.CustomerID; CREATE VIEW `SALES_FACT_VIEW` AS SELECT st.TDate, st.StoreID, sv.ProductID, st.CustomerID, sv.TID AS TID, st.TTime AS TimeOfDay, p.ProductPrice*sv.NoOfItems AS DollarsSold, sv.NoOfItems AS UnitsSold FROM ZAGI_Sales_Dep.SOLDVIA AS sv, ZAGI_Sales_Dep.PRODUCT AS p, ZAGI_Sales_Dep.SALESTRANSACTION AS st WHERE sv.ProductID = p.ProductID AND sv.TID = st.TID; INSERT INTO ZAGI_Dimensional.SALES_FACT (CalendarKey, StoreKey, ProductKey, CustomerKey, TID, TimeOfDay, DollarsSold, UnitsSold ) SELECT CA.CalendarKey, S.StoreKey, P.ProductKey, CU.CustomerKey, SFV.TID, SFV.TimeOfDay, SFV.DollarsSold, SFV.UnitsSold FROM ZAGI_Sales_Dep.SALES_FACT_VIEW AS SFV, ZAGI_Dimensional.CALENDAR_D AS CA, ZAGI_Dimensional.PRODUCT_D AS P, ZAGI_Dimensional.STORE_D as S, ZAGI_Dimensional.CUSTOMER_D AS CU WHERE CA.FullDate = SFV.TDate AND S.StoreID = SFV.StoreID AND P.ProductID = SFV.ProductID AND CU.CustomerID = SFV.CustomerID;
  • 10. E8.1b, E8.1c Aggregated Fact Table A dimensional model above contains an aggregated fact table, which shows a summary of units sold and dollars sold for daily purchases of each product in each store. It is populated as shown below. INSERT INTO ZAGI_Dimensional.AGGREGATED_FACT (CalendarKey, StoreKey, ProductKey, DollarsSold, UnitsSold) SELECT SF.CalendarKey, SF.StoreKey, SF.ProductKey, SUM(DollarsSold), SUM(UnitsSold) FROM ZAGI_Dimensional.SALES_FACT SF GROUP BY CalendarKey, StoreKey, ProductKey;
  • 11. Source 1: ZAGI Sales Department data
  • 12. Source 2: ZAGI Facilities Department data
  • 13. Source 3: Customer Demographic data external table
  • 14. ZAGI Sales Dimensional DW: fact tables populated with data, Calendar dimension
  • 15. ZAGI Sales Dimensional DW: Store, Product and Customer Dimensions Populated with data
  • 16. E8.2 City Police Department Consider the following scenario involving the City Police Department. The City Police Department wants to create an analytical database to analyze its ticket revenue. The two available data sources, Source 1 and Source 2, are described below. • Source 1 The City Police Department maintains the Ticketed Violations Database, shown in Figure below. • Source 2 The Department of Motor Vehicles (DMV) maintains the Vehicle Registration Table, shown in Figure below
  • 17. Source 1: CPD Ticketed Violations
  • 18. Source 1: CPD Ticketed Violations
  • 19. Source 2: DMV Vehicle Registration Table
  • 20. E8.2 Ticket Revenue Data Warehouse The data warehouse has to enable an analysis of ticket revenues by: • date, including: full date day of week, day of month, month, quarter, year • officer, including: officer ID, officer name, officer rank • payer of the ticket, including: payer DLN, payer name, payer gender, payer birth year • vehicle, including: vehicle LPN, vehicle make, vehicle model, vehicle year, vehicle owner DLN, vehicle owner name, vehicle owner gender, vehicle owner birth year • ticket type, including: ticket category (driving or parking), ticket violation, ticket fee
  • 21. Ticket Revenue Dimensional DW model (star schema)
  • 22. INSERT INTO statements INSERT INTO CPD_Ticket_Revenue.CALENDAR (FullDate, DayOfWeek, DayOfMonth, Month, Quarter, Year ) SELECT DISTINCT DTDate as FullDate, DAYOFWEEK(DTDate) AS DayOfWeek, dayofmonth(DTDate) AS DayOfMonth, month(DTDate) AS Month, quarter(DTDate) AS Qtr, year(DTDate) AS Year FROM CPD_Ticketed_Violations.DRIVINGTICKET UNION SELECT DISTINCT PTDate as FullDate, DAYOFWEEK(PTDate) AS DayOfWeek, dayofmonth(PTDate) AS DayOfMonth, month(PTDate) AS Month, quarter(PTDate) AS Quarter, year(PTDate) AS Year FROM CPD_Ticketed_Violations.PARKINGTICKET; INSERT INTO CPD_Ticket_Revenue.OFFICER (OfficerID, OfficerName, OfficerRank) SELECT OfficerID, OfficerName, OfficerRank FROM CPD_Ticketed_Violations.OFFICER; INSERT INTO CPD_Ticket_Revenue.TICKETTYPE (TicketCategory, TicketViolation, TicketFee) SELECT * FROM CPD_Ticketed_Violations.DTICKETTYPE UNION SELECT * FROM CPD_Ticketed_Violations.PTICKETTYPE; INSERT INTO CPD_Ticket_Revenue.PAYER (PayerDLN, PayerName, PayerGender, PayerBirthYear)SELECT * FROM CPD_Ticketed_Violations.DRIVER; INSERT INTO CPD_Ticket_Revenue.VEHICLE (VehicleLPN, VehicleMake, VehicleModel, VehicleYear, VehicleOwnerDLN, VehicleOwnerName, VehicleOwnerGender, VehicleOwnerBirthYear) SELECT v1.VehicleLPN, v2.VehicleMake, v2.VehicleModel, v2.VehicleYear, v2.OwnerDLN, v2.OwnerName, v2.OwnerGender, OwnerBirthYear FROM CPD_Ticketed_Violations.VEHICLE AS v1, CPD_Vehicle_Registration_Table.VRT AS v2 WHERE v1.VehicleLPN = v2.VehicleLPN;
  • 23. INSERT INTO CPD_Ticket_Revenue.REVENUE_FACT (CalendarKey, OfficerKey, PayerKey, VehicleKey, TicketTypeKey, TicketID, Amount)SELECT C.CalendarKey, O.OfficerKey, P.PayerKey, V.VehicleKey, TT.TicketTypeKey, dt.DTID AS TID, dtt.DTFee AS Amount FROM CPD_Ticketed_Violations.DRIVINGTICKET dt, CPD_Ticketed_Violations.DTICKETTYPE dtt, CPD_Ticket_Revenue.CALENDAR as C, CPD_Ticket_Revenue.PAYER as P, CPD_Ticket_Revenue.VEHICLE as V, CPD_Ticket_Revenue.OFFICER as O, CPD_Ticket_Revenue.TICKETTYPE AS TT WHERE dt.DTTypeID = dtt.DTTypeID and dt.OfficerID = O.OfficerID and dt.DLN = P.PayerDLN and dt.VehicleLPN = V.VehicleLPN and dt.DTTypeID = TT.TicketCategory and C.FullDate = dt.DTDateGROUP BY TID UNION SELECT C.CalendarKey, O.OfficerKey, P.PayerKey, V.VehicleKey, TT.TicketTypeKey, pt.PTID AS TID, ptt.DTFee AS Amount FROM CPD_Ticketed_Violations.PARKINGTICKET pt, CPD_Vehicle_Registration_Table.VRT vr, CPD_Ticketed_Violations.PTICKETTYPE ptt, CPD_Ticket_Revenue.CALENDAR as C, CPD_Ticket_Revenue.PAYER as P, CPD_Ticket_Revenue.VEHICLE as V, CPD_Ticket_Revenue.OFFICER as O, CPD_Ticket_Revenue.TICKETTYPE AS TT WHERE pt.PTTypeID = ptt.PTTypeID and pt.OfficerID = O.OfficerID and vr.OwnerDLN = P.PayerDLN and pt.VehicleLPN = V.VehicleLPN and pt.PTTypeID = TT.TicketCategory and C.FullDate = pt.PTDateGROUP BY TID;
  • 24. E8.2b,c Aggregated fact table A dimensional model above contains an aggregated fact table, which shows a summary of daily revenue amount for each officer. It is populated as shown below. INSERT INTO CPD_Ticket_Revenue.REV_OFFICER_BY_DAY (CalendarKey, OfficerKey, Revenue) SELECT CalendarKey, OfficerKey, SUM(Amount) FROM CPD_Ticket_Revenue.REVENUE_FACT GROUP BY CalendarKey, OfficerKey;
  • 25. Sources 1: CPD Ticketed Violations data
  • 26. Source 2: DMV Vehicle Registration table
  • 27. Ticket Revenue DW: Fact Tables populated with data, Calendar dimension
  • 28. Ticket Revenue DW: Payer, Vehicle, Officer and TicketType Dimensions Populated with Data
  • 29. E8.3 Big Z Inc. Automotive Products Consider the following scenario involving Big Z Inc., an automotive products wholesaler analytical database Big Z Inc. wants to create the (data warehouse) to analyze its order quantities. The two available data sources, Source 1 and Source 2, are described below. The three available data sources are: • Source 1 The Big Z Inc. Human Resources Department Table, shown below. • Source 2 The Big Z Inc. Orders Database, shown in Figure bellow.
  • 30. Source 1: HR Department table
  • 31. Source 2: Big Z Orders database
  • 32. E8.3 Dimensional Warehouse The data warehouse has to enable an analysis of order quantities by: • date, including: full date, day of week, day of month, month, quarter, year • time • product, including product ID, product name, product type, product supplier name • customer, including: customer ID, customer name, customer type, customer zip • depot, including depot ID, depot size, depot zip • order clerk, including: order clerk id, order clerk name, order clerk title, order clerk education level, order clerk year of hire Based on the sources and requirements listed above, create a dimensional model that will be used for the dimensionally modeled data warehouse for Big Z Inc.
  • 33. Big Z Order Quantities Dimensional DW model (star schema)
  • 34. Big Z Orders Quantities Normalized schema
  • 35. E8.3 INSERT INTO Statements INSERT INTO BigZ_Dimensional.CALENDAR (FullDate, DayOfWeek, DayOfMonth, MONTH, Quarter, YEAR)SELECT DISTINCT OrderDate AS FullDate, DAYOFWEEK(OrderDate) AS DayOfWeek, dayofmonth(OrderDate) AS DayOfMonth, month(OrderDate) AS MONTH, quarter(OrderDate) AS Qtr, year(OrderDate) AS YEAR FROM BigZ_Orders.ORDER_; INSERT INTO BigZ_Dimensional.CUSTOMER (CustomerID, CustomerName, CustomerType, CustomerZip) SELECT * FROM BigZ_Orders.CUSTOMER; INSERT INTO BigZ_Dimensional.DEPOT (DepotID, DepotSize, DepotZip)SELECT * FROM BigZ_Orders.DEPOT; INSERT INTO BigZ_Dimensional.ORDERCLERK (OCID, OCName, OCTitle, OCEducation, OCYofhire) SELECT oc.OCID, oc.OCName, hr.Title, hr.EducationLevel, hr.YearOfHire FROM BigZ_Orders.ORDERCLERK AS oc, BigZ_HR_Table.HRDEPARTMENT AS hr WHERE oc.OCID = hr.EmployeeID; INSERT INTO BigZ_Dimensional.PRODUCT (ProductID, ProductName, ProductType, SupplierName)SELECT p.ProductID, p.ProductName, p.ProductType, s.SupplierNameFROM BigZ_Orders.PRODUCT AS p, BigZ_Orders.SUPPLIER AS s WHERE p.SupplierID = s.SupplierID;
  • 36. INSERT INTO BigZ_Dimensional.ORDER_QUANTITY_FACT (CalendarKey, CustomerKey, DepotKey, OrderClerkKey, ProductKey, OrderID, TIME, Quantity) SELECT C.CalendarKey, CU.CustomerKey, D.DepotKey, OC.OCKey, P.ProductKey, OV.OrderID, O.OrderTime, sum(OV.Quantity) FROM BigZ_Dimensional.CALENDAR AS C, BigZ_Dimensional.CUSTOMER AS CU, BigZ_Dimensional.Depot AS D, BigZ_Dimensional.ORDERCLERK AS OC, BigZ_Dimensional.PRODUCT AS P, BigZ_Orders.ORDER_ AS O, BigZ_Orders.ORDERVIA AS OV WHERE O.OrderDate = C.FullDate AND O.CustomerID = CU.CustomerID AND O.DepotID = D.DepotID AND O.OCID = OC.OCID AND OV.ProductID = P.ProductID AND OV.OrderID = O.OrderIDGROUP BY OV.OrderID, OV.ProductID; INSERT INTO BigZ_Normalized.ORDERCLERK (OCID, OCName, Title, EducationLevel, YearOfHire) SELECT HR.EmployeeID as OCID, HR.Name as OCName, HR.Title, HR.EducationLevel, HR.YearOfHire FROM BigZ_HR_Table.HRDEPARTMENT HR, BigZ_Orders.ORDERCLERK OC WHERE HR.EmployeeID = OC.OCID; INSERT INTO BigZ_Normalized.CUSTOMER SELECT *FROM BigZ_Orders.CUSTOMER; INSERT INTO BigZ_Normalized.DEPOT SELECT *FROM BigZ_Orders.DEPOT; INSERT INTO BigZ_Normalized.PRODUCT SELECT p.ProductID, p.ProductName, p.ProductType, s.SupplierName FROM BigZ_Orders.PRODUCT AS p, BigZ_Orders.SUPPLIER AS s WHERE p.SupplierID = s.SupplierID; INSERT INTO BigZ_Normalized.ORDER_SELECT * FROM BigZ_Orders.ORDER_; INSERT INTO BigZ_Normalized.ORDERVIA SELECT * FROM BigZ_Orders.ORDERVIA;
  • 37. Source 1: HR Department table
  • 38. Source 2: Big Z Orders Database
  • 39. E8.3 Dimensional DW: Fact Table populated with data, Calendar dimension
  • 40. E8.3 Dimensional DW: Customer, Depot, Order Clerk and Product dimensions with data
  • 41. References: Jukic N., Vrbsky S., Nestorov S. “Database Systems. Introduction to Databases and Data Warehouses”. Pearson Education Inc., 2014.