Lab1 Dimensional Modeling
Lab1 Dimensional Modeling
Lab1
The Dimensional Modeling Process
Lab Requirements
To complete this lab you will need the following:
Access to the Northwind Database on Microsoft SQL Server 2012. This should
be available through your iSchool vSphere login.
You should connect to your SQL server database before starting this lab.
The High-Level and Detailed dimensional modeling Excel Workbooks,
available in the same place where you got this lab.
Microsoft Excel 2007 or higher for editing the worksheets
Grading
This lab may be handed in as part of a problem set.
1 | Page
Lab1
The Dimensional Modeling Process
NOTE: You can view this database diagram on-line. Its under the Database
Diagrams section of your Northwind database and is accessible through SQL Server
Management Studio.
Lab1
The Dimensional Modeling Process
As part of the business requirements, the following Enterprise Bus Matrix was
created.
Dimensio
n
Bus.
Process
Sales
Reporting
Order
Fulfillmen
t
Inventory
Analysis
Sales
Coverage
Orde
r
Date
Shippe
d
Date
Custome
rs
Employe
es
Shippe
rs
Produc
ts
Supplie
rs
Territ
ory
Connect to your SQL Server using SQL Server Management Studio and
open the Northwind database.
Open the High-Level-Dimensional-Modeling Excel Workbook, to the Detailed
Bus Matrix worksheet.
3 | Page
Lab1
The Dimensional Modeling Process
At this point you might be wondering: what does order detail look like and how to
we know it is what we need? This is
where data profiling comes into play.
Lets take a look.
DO THIS: Switch to your SQL Server,
and from SQL Server Management
Studio, open a new Query window (Ctrl
N) and type select * from [Order Details]
Then press [F5] to execute. You should
see results like this
4 | Page
Lab1
The Dimensional Modeling Process
5 | Page
Lab1
The Dimensional Modeling Process
Lab1
The Dimensional Modeling Process
Once youve identified a useful dimension, its time to add it to our Detailed Bus
Matrix like so:
7 | Page
Lab1
The Dimensional Modeling Process
Start with the dimensions youve identified in your Detailed Bus Matrix.
You can profile for useful dimensional attributes with a SQL query like this:
select * from [table_name]
Lab1
The Dimensional Modeling Process
When youre done. Save your worksheet before moving on to the next step.
Database: NorthwindDW
Description: The Northwind Traders Data Warehouse
Gen FKs?: Y
Schema For Views: (leave blank)
Lab1
The Dimensional Modeling Process
The process youll follow to design a dimension or fact table is outlined in 5 Steps:
1.
2.
3.
4.
5.
10 | P a g e
Lab1
The Dimensional Modeling Process
NOTE: Included in this detailed design are techniques for dealing with type-2 SCDs
and an audit dimension (everything from row 22 and higher in the screenshot). Both
of these techniques are covered in the ETL chapters of our course. For now, we can
leave these in our design. Well revisit them later.
Step 4: Target (dimensional table) table definition
In this next step, youll define the table definition for our dimension table in our
ROLAP star schema. You work here follows along with normal relational table design
definitions.
The columns youll need to complete in this step for each attribute are:
Datatype, Size, Precision the SQL Server datatype (including size and
precision, where appropriate) of the attribute. A good rule of thumb is to
check the source data type for reference. It should be noted that data types
11 | P a g e
Lab1
The Dimensional Modeling Process
vary from DBMS to DBMS. SQL server datatype reference can be found at
http://msdn.microsoft.com/en-us/library/ms187752.aspx.
Key? Should be blank if not a key or labeled PK = primary key, PK ID =
primary key (with surrogate), or FK = foreign key.
FK To When you label an attribute as FK, you need to include a dimension
table and its primary key as the referencing column.
NULL? Whether or not the attribute permits null values. This should only be
permitted in very rare circumstances. The better design decision is to provide
a default value in place of NULL.
Default Value A value which should be stored in the event there is no
value.
Source System List the source system for the attribute. Derived implies
the attribute is calculated.
Source Schema If the attribute comes from a specific schema, list it here.
Source Table State the table the attribute comes from on the source
system.
Source Field Name The column or columns which supply the attribute. If
the column is a calculation, specify that here (ex. OrderQty*Price).
12 | P a g e
Lab1
The Dimensional Modeling Process
Next Steps
Finish your detailed design by repeating steps 1-5 for your other dimensions and
fact table for the sales reporting process. Youll probably have to do a bit of profiling
to complete the process. Ask questions if you have them, or if working outside of
class time, log your issues to the issues worksheet.
Lab1
The Dimensional Modeling Process
a. Update any changes to your existing fact and dimension tables. Dont
add another customer dimension if theres one already there.
Remember we strive for conformed dimensions and consolidated
fact tables.
b. Add new fact and dimensions table designs that you have, basing them
on your Attributes & Metrics worksheet from the first step.
c. In both cases make sure to be complete in your documentation
process, including the target table design for your star schema and
information regarding your data source so that you have what is
required for the ETL design.
d. Any issues you encounter, such as not knowing how to source your
data, should be placed in the issues list (in the other workbook).
14 | P a g e