You are on page 1of 40

Ecommerce Data Models

Week – 04
Prof. Sangjukta
Topics to be discussed in this unit:
• Facts and Dimensions Data Models

• Simple Ecommerce Data Model

• Inventory Fact, Product Fact, Order Fact, Order Item Fact, Customers Fact, Customer Order Fact

• Common Dimensions and Measures in Ecommerce

Classify and enumerate different Data Models pertaining to Ecommerce.


Ecommerce Data Models
Ecommerce data models represent the structure and relationships of data within an ecommerce
system. They are designed to efficiently store and manage information related to products,
customers, orders, payments, and other relevant entities.
Some common components of ecommerce data
models:
1. Products
2. Categories
3. Customers
4. Orders
5. Payments
6. Reviews and Ratings
7. Inventory
8. Discounts and Promotions
Considerations for Ecommerce Data Models:

1. Data Integrity

2. Scalability and Performance

3. Security and Privacy

4. Extensibility
Facts and Dimensions Data Models
In the context of ecommerce data models, the concepts of facts and dimensions are often used to
design more sophisticated and analytical data models.
1. Facts:
• Facts represent the measurable and numeric data in an ecommerce system. They capture the
quantitative aspects of business transactions or events.

2. Dimensions:
• Dimensions provide context and descriptive attributes to the facts. They provide additional
information for analyzing and filtering the facts.

3. Fact Tables:
• Fact tables are the central tables in a data model that store the facts and their associated keys.
They contain foreign keys that link to the dimension tables and measure columns that hold the
numeric data.

4. Dimension Tables:
• Dimension tables store the descriptive attributes of dimensions. They provide additional context
for the facts.
What is Data Dimensional Modelling?

Data Dimensional Modelling (DDM) is a technique that uses Dimensions and Facts to store the data in a Data
Warehouse efficiently. It optimises the database for faster retrieval of the data. Dimensional Models have a
specific structure and organise the data to generate reports that improve performance.
Key Features of Dimensional Data Modelling

• Easy to Understand
• Promote Data Quality
• Optimize Performance

Components of Dimensional Data Modelling


There are 5 main components of any DDM. They are given below.

• Dimension
• Facts
• Attributes/Measures
• Fact Tables
• Dimension Tables
Types of Dimensions in Dimensional Data
Modelling
There are 9 types of Dimensions/metrics when dealing with Dimensional Data Modelling.

• Conformed Dimension
• Outrigger Dimension
• Shrunken Dimension
• Role-Playing Dimension
• Dimension to Dimension Table
• Junk Dimension
• Degenerate Dimension
• Swappable Dimension
• Step Dimension
Steps to Carry Out Dimensional Data Modelling
Dimensional Data Modelling requires certain analysis on the data to understand data behaviour and
domain. The main goal a Dimensional Data Model tries to address is that it tries to describe the Why,
How, When, What, Who, Where of the business process in detail.
The major steps to start Dimensional Data Modelling are:

• Identify the Business Process

• Identify the Grain

• Identify the Dimensions

• Identify the Facts

• Build the Schema


Simple Ecommerce Data Model
A simple ecommerce data model typically consists of essential entities and relationships necessary to support
basic ecommerce operations.

1.Entities:
a. Product
b. Category
c. Customer
d. Order
e. OrderItem

2.Relationships:
1. A product belongs to a category (Many-to-One relationship).
2. A customer can place multiple orders (One-to-Many relationship).
3. An order can have multiple order items (One-to-Many relationship).
4. Each order item is associated with a product (Many-to-One relationship).
Inventory Fact in Ecommerce Data Models
In ecommerce data models, the inventory fact represents the quantitative information related to the
stock or inventory of products. It provides valuable insights into the availability of products, stock
levels, and can be used for inventory management purposes.
1. Inventory Fact Table
2. Dimensions Related to Inventory Fact
a. Product Dimension
b. Time Dimension
c. Location Dimension (Optional)
3. Measures in Inventory Fact
1. Stock Quantity
2. Stock Value
3. Replenishment Date
4. Stock Turnover
5. Stockouts
Product Fact in Ecommerce Data Models
In ecommerce data models, the product fact represents the quantitative information related to
products, such as sales, revenue, and other performance metrics. It provides insights into the sales
performance and popularity of different products.
1. Product Fact Table
2. Dimensions Related to Product Fact
a. Product Dimension
b. Time Dimension
c. Customer Dimension
1. Measures in Product Fact
1. Sales Quantity
2. Revenue
3. Profit
4. Discounts
5. Returns
6. Average Selling Price
Order Fact in Ecommerce Data Models
In ecommerce data models, the order fact represents the quantitative information related to customer
orders, such as order quantity, revenue, and other order-related metrics. It provides insights into the
sales performance, customer behavior, and order patterns within an ecommerce system.
1.Order Fact Table
2.Dimensions Related to Order Fact
a. Time Dimension
b. Customer Dimension
c. Product Dimension
d. Payment Dimension
3. Measures in Order Fact
1. Order Quantity
2. Revenue
3. Discounts
4. Shipping Costs
5. Gross Profit
6. Average Order Value
Order item Fact in Ecommerce Data Models
In ecommerce data models, the order item fact represents the quantitative information related to
individual items within customer orders. It provides detailed insights into the products, quantities,
prices, and discounts associated with each item in an order.
1.Order Item Fact Table
2.Dimensions Related to Order Item Fact
a. Order Dimension
b. Product Dimension
c. Time Dimension (Optional)
d. Customer Dimension (Optional)
3. Measures in Order Item Fact
1. Quantity
2. Price
3. Discounts
4. Total Price
Customers Fact in Ecommerce Data Models
The customer fact represents the quantitative information related to customers, their behaviors, and
interactions within an ecommerce system. It provides insights into customer demographics, purchasing patterns,
loyalty, and other customer-related metrics.
1. Customer Fact Table
2. Dimensions Related to Customer Fact
a. Time Dimension (Optional):
b. Product Dimension (Optional)
c. Location Dimension (Optional)
3. Measures in Customer Fact:
1. Total Orders
2. Total Revenue
3. Average Order Value
4. Customer Lifetime Value
5. Repeat Purchase Rate
Customers Order Fact in Ecommerce Data Models
The customer order fact represents the quantitative information related to customer orders and their
associated customers. It provides insights into customer purchasing behavior, order history, and
customer-specific metrics within an ecommerce system.
1. Customer Order Fact Table
2. Dimensions Related to Customer Order Fact
a. Customer Dimension
b. Order Dimension
c. Product Dimension
d. Time Dimension
3. Measures in Customer Order Fact:
1. Order Quantity
2. Order Revenue
3. Discounts Applied
4. Average Order Value
Common Dimensions and Measures in Ecommerce
Data Warehousing
Data warehousing is a technique in which information is stored in a central repository that can be
used by business analysts, data engineers, data scientists, and decision-makers through business
intelligence (BI) tools to make decisive decisions.

Advantages of Data Warehousing

1. It makes information easily accessible.


2. It presents information consistently.
3. It adapts to changes in the data.
4. It presents information in a timely way.
5. It is secure, so it protects the information assets.
Dimensional Modeling
The data model used to store data in the denormalized form is called Dimensional Modeling. It is
the technique of storing data in a Data Warehouse in such a way that enables fast query
performance and easy access to its business users. It involves creating a set of dimensional tables
that are designed to support business intelligence and reporting needs.
Four Steps of Designing a Dimensional Model

Step 1: Select the Business Process

Step 2: Decide the Grain of each Business Process

Step 3: Identify the Dimensions for the Dimensional Table

Step 4: Identify the Facts for the Dimensional Table


Dimensional Tables

These are the tables that are joined to fact tables. It describes the “who, what, where, when,
how, and why” associated with the business event. It contains the descriptive attributes used for
grouping and filtering the facts.

Some important points regarding Dimension Tables

1. It stores textual information related to a business process.


2. It answers the ‘who, what, where, when, why, and how’ questions related to a particular
business process.
3. Dimension tables have more columns and less number of rows.
4. Each dimension table has a primary key that is joined to its given fact table.
5. Dimension attributes are the primary source of query constraints, grouping, and filtering.
Date Dimension: This dimension table is used in almost every dimensional model as it helps monitor the
business’s performance with time.

Product Dimension: This table will contain information regarding the product ordered.
Order Dimension: This detail will contain information regarding the order.

Customer Dimension: This dimension table will contain the customer’s information
Promotion Dimension: This table covers the promotion condition under which the product was sold.
The promotion conditions include temporary sales, reduction in price, discounts, etc.

Warehouse Dimension: This table will contain information about the different warehouses located
across the country.
Fact Table

The term fact represents a business measure; therefore, a fact table in dimensional modeling stores the
performance measurements resulting from a business process. These performance measurements
measure the business, i.e., these are the metrics through which we can infer whether our business is in
profit or loss.

Fact Table 1:

Grain: Individual product of the order per row.


Fact Table 2:

Grain: Delivery Status of individual products in the order

Fact Table 3:

Grain: Daily inventory for each product in each store.


1. Transaction Fact Tables
2. Periodic Fact Tables
3. Accumulating Fact Tables
4. Factless Fact Tables

You might also like