Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Lecture 10: More OLAP - Dimensional modeling www.cl.cam.ac.uk/Teaching/current/Databases/

Similar presentations


Presentation on theme: "1 Lecture 10: More OLAP - Dimensional modeling www.cl.cam.ac.uk/Teaching/current/Databases/"— Presentation transcript:

1 1 Lecture 10: More OLAP - Dimensional modeling www.cl.cam.ac.uk/Teaching/current/Databases/

2 2 Conceptual Modeling of Data Warehouses Modeling data warehouses: dimensions & measures –Star schema: A fact table in the middle connected to a set of dimension tables –Snowflake schema: A refinement of star schema where some dimensional hierarchy is normalized into a set of smaller dimension tables, forming a shape similar to snowflake –Fact constellations: Multiple fact tables share dimension tables, viewed as a collection of stars, therefore called galaxy schema or fact constellation

3 3 Star

4 4 Star Schema

5 5 Terms Fact table Dimension tables Measures

6 6 Another Star Schema time_key day day_of_the_week month quarter year time location_key street city province_or_street country location Sales Fact Table time_key item_key branch_key location_key units_sold dollars_sold avg_sales Measures item_key item_name brand type supplier_type item branch_key branch_name branch_type branch

7 7 Dimension Hierarchies store sType cityregion  snowflake schema  constellations

8 8 Cube Fact table view: Multi-dimensional cube: dimensions = 2

9 9 3-D Cube day 2 day 1 dimensions = 3 Multi-dimensional cube:Fact table view:

10 10 Aggregates Add up amounts for day 1 In SQL: SELECT sum(amt) FROM SALE WHERE date = 1 81

11 11 Aggregates Add up amounts by day In SQL: SELECT date, sum(amt) FROM SALE GROUP BY date

12 12 Another Example Add up amounts by day, product In SQL: SELECT date, sum(amt) FROM SALE GROUP BY date, prodId drill-down rollup

13 13 Aggregates Operators: sum, count, max, min, median, ave “Having” clause Using dimension hierarchy –average by region (within store) –maximum by month (within date)

14 14 Cube Aggregation day 2 day 1 129... drill-down rollup Example: computing sums

15 15 Cube Operators day 2 day 1 129... sale(c1,*,*) sale(*,*,*) sale(c2,p2,*)

16 16 Extended Cube day 2 day 1 * sale(*,p2,*)

17 17 Aggregation Using Hierarchies day 2 day 1 customer region country (customer c1 in Region A; customers c2, c3 in Region B)

18 18 Pivoting day 2 day 1 Multi-dimensional cube: Fact table view:


Download ppt "1 Lecture 10: More OLAP - Dimensional modeling www.cl.cam.ac.uk/Teaching/current/Databases/"

Similar presentations


Ads by Google