Data Modelling
Data Modelling
Data warehouse is
• Subject-oriented
• Integrated
• Non-volatile
• Time-variant
collection of data points
Journey of Data in an Organization
ER Diagram
Star Schema Dimension
Table
Dimension Dimension
Table Table
Fact
Table
Dimension Dimension
Table Table
Snowflake Schema Dim Dim
Table L2 Table L2
Dim
Dim Table L1 Dim
Table L2 Table L2
Dim Dim
Dim
Table L1 Table L1 Dim
Table L2
Fact Table L2
Dim
Table L2
Table Dim
Table L2
Dim Dim
Table L1 Table L1
Dim Dim
Table L2 Dim Table L2
Table L1
Dim Dim
Table L2 Table L2
DDL and DML
Data Definition Language Data Manipulation Language
• CREATE • INSERT
• Schema • UPDATE
• Tables
• DELETE
• Views
• Constraints
• ALTER
• DROP
• Operates on the structure of the • Operates on the contents of the
Entity Entity
Data Modelling
Session 2: Building blocks of data modelling
Introduction to Data Modelling
Database Design
Design
Development/Implementation
Manipulation
Revision
Production
Maintenance
Relational Schemas
Advantages Disadvantages
branch_details product_info
* store_id * product_id
store_name product_name
area product_category
city list_price
state sale_price
Database Creation
• CREATE DATABASE databasename;
• CREATE SCHEMA schemaname;
• USE databasename
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
DELETE table_name;
Understanding Customer Behaviour
• Number of Transactions by Gender
• Transactions by Men
• Transactions by Women
• Number of customers who have placed an order from more than 1
store
• City with highest number of orders
• Area with highest sales (Sum of all sales prices)
• State with highest customers