DAM Week 5
DAM Week 5
1
Dimension Table Fact Table
Helps to categorize, filter, and describe the Stores transactional or event-based data
data in fact tables (e.g., customers, products, (e.g., sales, orders, revenue).
locations).
● Typically has a primary key that is ● Typically has foreign keys that
linked to fact tables. reference dimension tables.
● Contains textual or categorical data ● Contains numerical values that are
that provides context to the facts. used for aggregation (e.g., SUM, AVG).
● Rows represent descriptive details like ● Rows represent events or
people, places, or things. transactions.
● Customer Dimension Table: Contains ● Sales Fact Table: Contains fields like
Customer Name, Age, Location. Sale Amount, Quantity Sold, and Date.
● Product Dimension Table: Contains ● Orders Fact Table: Contains fields like
Order ID, Total Price, and Order Date.
Product Name, Category, Price.
2
Types of Joins
One-to-One Relationship:
● Definition: Each row in Table A relates to exactly one row in Table B, and
vice versa.
● Use case: Linking tables where both have unique keys.
● Impact: Ensures no duplicates on either side of the relationship.
3
Types of Joins
One-to-Many Relationship:
● Definition: One row in Table A can relate to multiple rows in Table B, but
rows in Table B relate to only one row in Table A.
● Use case: Common for linking dimension tables (like Product or
Customer) to fact tables (like Sales).
● Example: A Customer table related to an Orders table where one
customer can have many orders.
● Impact: Allows aggregation from the many side to the one side (e.g., total
orders per customer).
4
Types of Joins
Many-to-Many Relationship:
● Definition: Rows in Table A can relate to multiple rows in Table B, and vice
versa.
● Use case: Needed when no table acts purely as a dimension table.
● Example: A Projects table linked to an Employees table, where employees
can work on multiple projects and each project can have multiple
employees.
● Impact: Requires a bridge or intermediate table to manage complexity in
data models.