0% found this document useful (0 votes)
38 views

Chap2 - Table Relationship and Data Models

This document discusses data modeling concepts including: 1) Data models connect tables through relationships based on common fields, unlike independent tables with no connections. 2) Normalization organizes tables and columns to reduce data redundancy and integrity issues when modifying data. 3) Data models contain data tables with values/facts and lookup tables with descriptive attributes about each dimension. 4) Relationships connect primary and foreign keys to link tables based on common fields.

Uploaded by

Pranay Reddy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views

Chap2 - Table Relationship and Data Models

This document discusses data modeling concepts including: 1) Data models connect tables through relationships based on common fields, unlike independent tables with no connections. 2) Normalization organizes tables and columns to reduce data redundancy and integrity issues when modifying data. 3) Data models contain data tables with values/facts and lookup tables with descriptive attributes about each dimension. 4) Relationships connect primary and foreign keys to link tables based on common fields.

Uploaded by

Pranay Reddy
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Table Relationship and Data

Models
Yunkai Liu, Ph.D.
Gannon University
What is “Data Model”
• What we have so far is a collection of independent tables which share
no connections or relationships. NOT data model.

• In a data model, the tables are connected via relationships based on a


common field or key (ProductKey Column)
Database Normalization
• Normalization is the process of organizing the tables and columns in a
relational database to reduce redundancy and preserve data integrity.
It is commonly used to
• Eliminate redundant data to decrease table sizes, reduce processing speed
and improve efficiency.
• Minimize errors and anomalies when we make data modifications. (insert,
delete and update)
• Simplify queries and structure the database in a way that enables
meaningful, useful analysis.
• Tip: In a properly normalized database, every table should serve it
distinct and specific purpose.
Data Tables vs Lookup Tables
• Data models contain two different types of tables: data (or “fact”)
tables and lookup (or “dimension”) tables.
• Data tables contain numbers or values, typically at a granular level, with ID or
“key” columns that can be used to create table relationships.
• Lookup tables provide descriptive, often text based attributes or
characteristics about each dimension and table.
Creating Table Relationships
• Option 1: Click and drag to connect primary and foreign keys within
the Relationship pane

• Option 2: Add or detect relationships using the “Manage


Relationships” dialog box
Practice
• AW_Sales  AW_Customer_Lookup
• AW_Sales  AW_Calendar_Lookup
• AW_Sales  AW_Territories_Lookup
• AW_Sales  AW_Product_Lookup

• Star Schema
Practice (cont)
• AW_Product_Lookup  AW_Product_Subcategories
• AW_Product_Subcategories  AW_Product_Categories

• Snowflake
Manage and Edit Relationship
• Please edit the relations between AW_Sales  AW_Calendar
• Change from the order_date into stock_date
• And change back
Active vs Inactive Relationship
• Add another relationship AW_Sales  AW_Calendar
• Using Stock_date vs date

• Try to active or inactive relationships


• Remember, you have to inactive relationship first, then you can active one.
Connecting Multiple Data Tables
• Pre work
• Get data  CSV  AdventureWorks_Return.csv  Transform data  rename
as “AW_Returns”  Close and Apply

• Back to Relationship
• Note, we cannot connect AW_Returns with AW_Sales. M-M relationship error
• We have to relate AW_Returns with other tables like AW_Sales.
Report
• Click “Report”  Drag “ProductName” and “OrderQuantity” into
report  Drag “ReturnQuantity” into “Value” under Visualization

• Let us say we want to understand the difference between Male and


Female order and return quantity
• Remove “ProductName”
• Drag “Gender” into “Value”
Filter Flow
• Let us say we want to understand the difference territory order and return quantity

• Case 1
• Remove “ProductName”
• Drag “SaleTerritoryKey” under AW_Territory Table into “Value”
• Case 2
• Remove “SaleTerritoryKey”
• Drag “TerritoryKey” under AW_Sale Table into “Value”
• Case 3
• Remove “TerritoryKey”
• Drag “TerritoryKey” under AW_returns Table into “Value”

• Question: which one is right?


Hide Fileds
• Fields, especially Foreign Keys are confusing in the report.

• Sometime it is good idea to “Hide” them

• Let us do that in the relationships


• Note it also can be done in “Data”

You might also like