Professional Documents
Culture Documents
EDUCATION
EDUCATION
Dept
Market
Month
Class
Store
Day
Item
Fact Sales
EDUCATION
EDUCATION
1001 1002
Bost on Greenw ich Providence Balt imore Philadelphia Charlot t e Durham Greenville A t lant a Fayet t eville M id-A t lant ic New England Carolinas Deep Sout h Nort heast Sout h
101 102 103 104 105 106 107 108 109 110
20 20 20 10 10 30 30 30 40 40 10 20 30 40
1 1 1 1 1 2 2 2 2 2 1 1 2 2 1 2
1 1 1 1 1 1 1 1 1 1 2 2 2 2 3 3
Star #1
Lookup Geography Geo_key Geo_desc Store_id Market_id Region_id Level
1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016
Null fields
Level flag
EDUCATION
Limitation of Consolidated Star (1) How do we get the following desired report?
Region Store Sales $
Necessary Tables:
Lookup Geography Geo_key Geo_desc Store_id Market_id Region_id Level Fact Sales Product_key Geo_key Time_key Sales_Dollars Sales_Units
SELECT a1.Geo_desc Region, a2.Geo_desc Store FROM LU_Geo a1, LU_Geo a2, Fact a3 WHERE a1.Geo_Key = a2.Geo_Key a2.Geo_Key = a3.Geo_Key a1.level = 3 a2.level = 1 GROUP BY Region, Store
Self-join is necessary.
EDUCATION
EDUCATION
Lookup Geography Geo_key Store_id Store_desc Market_id Market_desc Region_id Region_desc Level
EDUCATION
Cons. Star #1
Cons. Star #2
Cons. Star #3
Lookup Geography Geo_key Store_id Store_desc Market_id Market_desc Region_id Region_desc Level
EDUCATION
Product_key Item Class Dept Division Item Class Dept Division Item Class Dept Division Item ...
Geo_key Store Store Store Store Market Market Market Market Region Region Region Region Store ...
Time_key Date Date Date Date Date Date Date Date Date Date Date Date Month ...
Sales 100 200 300 500 200 350 500 600 500 450 750 900 1500 ...
EDUCATION
Select Product_desc, Geo_desc, Time_desc, Sales_Dollars, Sales_Units From Fact_Sales F, Lookup_Product P, Lookup_Geography G, Lookup_Time T Where F.Product_key = P.Product_key And F.Geo_key = G.Geo_key And F.Time_key = T.Time_key And G.Level = ?? And P.Level = ?? And T.Level = ??
EDUCATION
Lookup Month Lookup Dept Dept_id Dept_desc Division_id Lookup Market Market_id Market_desc Region_id Month_id Month_desc Year_id
Lookup Class Class_id Class_desc Dept_id Lookup Store Store_id Store_desc Market_id
EDUCATION
1 2
Northeast South
MARKET_ID
MARKET_DESC REGION_ID
10 20
STORE_ID STORE_DESC MARKET_ID
1 1 2 2
101 102 103 104 105 106 107 108 109 110
Boston Greenwich Providence Baltimore Philadelphia Charlotte Durham Greenville Atlanta Fayetteville
20 20 20 10 10 30 30 30 40 40
30 40
EDUCATION
Lookup Dept Dept_id Dept_desc Division_id Lookup Market Market_id Market_desc Region_id
Lookup Class
Class_id Class_desc Dept_id Division_id Lookup Store Store_id Store_desc Market_id Region_id
Lookup Item
Item_id Item_desc Class_id Dept_id Division_id
EDUCATION
1 2
Northeast South
MARKET_ID
MARKET_DESC REGION_ID
10 20
STORE_DESC MARKET_ID REGION_ID
1 1 2 2
STORE_ID
30 40
101 102 103 104 105 106 107 108 109 110
Boston Greenwich Providence Baltimore Philadelphia Charlotte Durham Greenville Atlanta Fayetteville
20 20 20 10 10 30 30 30 40 40
1 1 1 1 1 2 2 2 2 2
EDUCATION
Lookup Day Lookup Store Store_id Store_desc Market_id Market_desc Region_id Region_desc Date Month_id Month_desc Year_id
Lookup Item
Item_id Item_desc Class_id Class_desc Dept_id Dept_desc Division_id Division_desc
EDUCATION
Snowflake #1
Snowflake #2
Snowflake #3
Lookup Store
Lookup Store
Lookup Store
EDUCATION
EDUCATION
EDUCATION
Region_id Region_desc
EDUCATION
Lookup Item Item_id Item_desc Class_id Class_desc Dept_id Dept_desc Division_id Division_desc
EDUCATION
vs.
Consolidated Star
Few Tables / Few Joins Easy SQL No support for M:M relationships Limited support for characteristic attributes Inflexible schema Not scalable
Snowflake
More Tables / More Joins More complex SQL M:M is possible Characteristic attributes fully supported Flexible schema Scalable
EDUCATION
EDUCATION