Defining Data Warehouse Structures

Data Warehouse Data Sources Staging Area Data Marts End User Data Access

Data Extract, Transform, and Load Data Access

Data Warehouse Structures Overview Data Warehouse OLAP End User Data Access Data Marts .

Sales_Fact TimeKey EmployeeKey ProductKey CustomerKey ShipperKey Sales Amount Unit Sales . Customer_Dim CustomerKey CustomerID ....The Star Schema Employee_Dim EmployeeKey EmployeeID . Product_Dim ProductKey ProductID .... .... Time_Dim TimeKey TheDate .. Shipper_Dim ShipperKey ShipperID ...

Describing Dimensions   Describing Business Entities Containing Attributes That Provide Context to Numeric Data Presenting Data Organized into Hierarchies  .

Identifying Primary Keys  Primary Keys   Identify Uniqueness Are the Dimension Columns Referenced in the Fact Table product_dim_key product_id_app  Two Candidates  Application Keys (app suffix) Are Source Data Values That Identify Uniqueness Surrogate Keys (key suffix) Are System-generated Integers That Identify Uniqueness  .

Defining Hierarchies Understanding Benefits of Hierarchies   Allow end users to view data at different levels of summarization Provide drill down / drill up paths of analysis Drill Down Drill Up   Implementing Hierarchies   Denormalized star schema dimensions Normalized snowflake dimensions .

Snowflaked Dimension Tables   Defines Hierarchies by Using Multiple Dimension Tables Is More Normalized than a Single Table Dimension .

Customer. Product. and Order Date Inventory Data By Inventory Date.Describing Fact Tables Sales Data By Product. and Warehouse .

Identifying Fact Table Components Dimension Tables customer_dim 201 ALFI Alfreds customer_key product_key time_key quantity_sales amount_sales 201 25 134 400 10. and order date .789 Sales_fact Table Foreign Keys Measures product_dim 25 123 Chai time_dim 134 1/1/2000 The grain of the sales_fact table is defined by the lowest level of detail stored in each dimension associated with the fact table The grain of the sales_fact table is sales data by customer ID. product ID.

Defining Foreign Keys FOREIGN KEY Constraint time_dim_key product_key customer_key order_date_key FOREIGN KEY Constraint customer_dim_key FOREIGN KEY Constraint product_dim_key  Physically implement the relationship between FK columns of the fact table and PKs of dimension tables Enforce referential integrity between the dimension tables and the fact table  .

Relational Schemas and OLAP Data Warehouse OLAP End User Data Access Data Marts .

OLAP Database Components  Numeric Measures  Data values or facts that users analyze  Dimensions    Business categories that provide context to numeric measures Sourced from columns in star schema dimensions Members are organized into hierarchies Combine dimensions and measures into one conceptual model  Cubes   Logical storage medium for an OLAP database .

Relational Dimensions vs. OLAP Dimensions REGION West East STATE CA OR MA NY REGION West West East East REGION West CA OR East MA NY OLAP Relational .

OLAP Dimension Fundamentals Year Time Dimension Table Year 1999 1999 Quarter Month Q1 Q1 … Jan Feb … Quarter … Month RELATIONAL OLAP .

Dimension Family Relationships  Drinks is the Parent of Tea and Coffee Tea and Coffee are Children of Drinks Tea and Columbian are Descendants of Drinks Drinks Tea Lemon Earl Grey Coffee Columbian       Tea and Drinks are Ancestors of Earl Grey Tea and Coffee are Siblings Lemon and Columbian are Cousins All are dimension Members .

Cube Measures      Are the Numeric Values of Principal Interest Correspond to a Fact Table’s Facts (or Measures) Intersect All Dimensions at All Levels Are Aggregated at All Levels of Detail Form a Dimension .

The Cube Q1 Q2 Q3 Q4 2002 Ave Units Sales Net Sales Units Price Dollars Measures Dimension Grapes Cherries Melons Apples .

Querying a Cube Q1 1000 Q2 Q3 Grapes Cherries Melons Apples Ave Sales Net Sales Units Units Price Dollars Measures Dimension Q4 .

Defining a Cube Slice Q1 Q2 Q3 Q4 Ave Units Sales Units Net Sales Price Dollars Grapes Cherries Melons Apples Measures Dimension .