# ERP data warehouse vs data lake
###### tags: `data warehouse` `warehouse` `ERP` `BI` `SAP` `Data modelling` `OLTP` `OLAP` `ERM` `SPM` `CRM` `star` `snowflake` `galaxy` `data lake` `denormalize` `normalize` `granularity` `header` `detail`
[TOC]
# ERM SPM CRM:

==CRM tập trung vào việc tăng doanh thu.==
# ERP:
==ERP nhấn mạnh đến việc giảm chi phí.==

ERP hợp nhất các thông tin được cung cấp bởi các nhóm chức năng khác nhau của tổ chức thông qua các hệ thống như CRM, Quản lý Chuỗi Cung ứng (SCM), Quản lý Nhân sự (HRM).
# Data Pineline:

# Data Pineline in AWS:

# Type of data in Data warehouse:
**Meta data:** is information about data.
**Summary data:** aggregated data
**Raw data:** is a set of information.
**Master Data:** This Data is key business information like Customer information , Employee , Materials etc.
**Transaction Data:** This is data related to day to day transactions.
## Meta data:
EX:
* Metadata for a web page may contain the language it is coded in, the tools used to build it, supporting browsers, etc.
* Metadata for a digital image may contain the size of the picture, resolution, color intensity, image creation date, etc.
* Metadata for a document may contain the document created date, last modified date, it's size, author, description, etc.
## Comparison type of data:

# Data warehouse:
Data warehouse is a ==system that pulls together data from many different sources for reporting and analysis.==
Các dữ liệu được lưu trữ phải trải qua quá trình ETL (Extract – Transform – Load) trước khi save data into data mart.
## Data mart:
==USEFUL LINK: http://madhu-dwh.blogspot.com/2013/01/data-warehouse.html==
Data ware house collects data from different sources and store the data in Data Marts.(well designed for Reporting tools.)




## Data warehouse vs Data mart:
Một data warehouse (kho dữ liệu – DWH) là một hệ thống được dùng để lưu trữ thông tin cho việc phân tích và báo cáo.
Data Marts là một tập con của data warehouses được dùng để lưu trữ thông tin cần thiết cho một phòng ban hoặc ngay cả một người dùng đơn lẻ. (Tưởng tượng DWH là một toà nhà, data marts là một văn phòng trong toà nhà).
Các dữ liệu liên quan được lưu trữ trong công ty DWH. Đối với hầu hết người dùng, họ chỉ cần truy cập vào một tập con dữ liệu cụ thể, giống như bán hàng (sales), sản xuất (production), giao vận (logistic) hoặc marketing
## Modern data warehouse:

## Data warehouse vs database:
Purpose / Time-frame / Format (relational / milti-dimensional)/ Record per request./ SYTEM
|Compare|Database|Warehouse|
|--------|-------|--------|
|Memory consume|less space|more space|
|Performance|slow | better ( less join)|



## OLAP:
Data Warehouse và các hệ thông OLAP được xây dựng theo mô hình **dữ liệu đa chiều (multi-dimensional model)**
Dữ liệu trong kho dữ liệu được thể hiện dưới dạng đa chiều (Multi Dimension) gọi là khối (cube). Mỗi chiều mô tả một đặc trưng nào đó của dữ liệu. (Nếu số chiều dữ liệu lớn hơn 3, gọi là Hyper Cube)


### OLTP vs OLAP:



# NORMALIZATION:
:::info
The purpose of Normalization to eliminate redundant (repetitive) data and ensure data is stored logically.
Normalization divides larger tables into smaller tables and links them using relationships.
EX: Header vs Detail table
This type of relationship is called one-to-many relationship. It is used when there is one parent record and multiple child records.
https://stackoverflow.com/questions/19963735/understanding-header-and-detail-tables
Header and Detail table concept is used to perform normalization in SQL. Normalization is the process of reducing data redundancy. We can not remove data redundancy. But we can reduce data redundancy. Data redundancy is duplicating the items.
:::
## Database Normal Forms:
Here is a list of Normal Forms:
* 1NF (First Normal Form)
* 2NF (Second Normal Form)
* 3NF (Third Normal Form)
* 4NF (Fourth Normal Form)
::: warning
* Data in 1NF and 2NF is duplicated & centralized. => Focus on minimizing excuted time + easyto query ( OLAP)
* Data in 3NF and 4NF là duy nhất| tường minh | bị chia nhỏ | không trùng lặp | dễ scale up + minimize storage. (OLTP)
:::
## Normalized data vs Denormalized data:
### Normalized data:

It consumes less space in the database.
### Denormalized data:

Performance:
It takes more space in the database than normalized tables. But ==the permanence with be good because of less joins== on the system with all required data in one table.
## Fact and Dimension:

Các chiều mũi tên đều hướng từ các bảng Dim xuống bảng Fact.
### Dim:

==Dim là các bảng chứa những thuộc tính / phân loại mà chúng ta cần phân tích, theo dõi và thống kê.==
Trong 1 Data Model, sẽ có rất nhiều bảng Dimension, và dung lượng của các bảng này thường rất nhỏ, đa số tầm khoảng < 100 dòng.
### Fact:

==Bảng Fact chứa các **CỘT** là measurement và **ROWS** là các transaction của business.==
Do đó, 1 bảng Fact có thể lên tới trăm nghìn, triệu dòng hoặc thậm chí tỉ dòng
### Fact vs Dimension:



# ERP VS SAP:

ERP stands for Enterprise Resource Planning **Software** that allows an organization to use a integrated applications system to manage a company’s resources efficiently and productively.
SAP is name of the company as well its ERP product.
# BI
Business intelligence (BI) combines business analytics, data mining, data visualization, data tools and infrastructure, and best practices to help organizations to make more data-driven decision
# Data Model vs Data Modeling:
:::danger
==A data model== is set of the tabular data connected together by relationships.
Data Model là một tổ hợp của nhiều bảng, và những bảng này liên kết với nhau bởi các relationships.
==Data modeling== is the process of creating a data model for the data to be stored in a Database.
:::
# Schema:
A schema is a blueprint ( ban thiet ke ) of the database.
## Type of Schema:
1. Star Schema.
1. Snow Flake Schema.
1. Galaxy Schema. (=Fact Constellation schema)
A fact constellation has multiple fact tables.

### Star vs Snow Flake schema:



## [Data lake vs Data warehouse:](https://blog.trginternational.com/vi/phan-biet-su-khac-nhau-giua-data-lake-va-data-warehouse#:~:text=H%C3%ACnh%20th%E1%BB%A9c%20Schema,l%C3%A0%20cung%20c%E1%BA%A5p%20b%C3%A1o%20c%C3%A1o.&text=C%C3%A1ch%20ti%E1%BA%BFp%20c%E1%BA%ADn%20n%C3%A0y%20%C4%91%C6%B0%E1%BB%A3c,chi%20ph%C3%AD%20cho%20doanh%20nghi%E1%BB%87p.)
to **store the big data**, the two most popular options: **data lakes and data warehouses


### Data type
**Data warehouse** cần một mô hình dữ liệu có cấu trúc rõ ràng giúp xác định các dữ liệu được lưu vào cũng như loại bỏ các dữ liệu không cần thiết.
**Data lake,** tất cả các loại dữ liệu từ các nguồn của hệ thống đều được lưu trữ. Bao gồm các nguồn dữ liệu có thể bị từ chối lưu trữ trong Data warehouse, chẳng hạn như nhật ký web server, dữ liệu cảm biến, hoạt động trên mạng xã hội, văn bản và hình ảnh.
### Schema:
**Data warehouse** áp dụng phương pháp **"Schema on Write"**, nghĩa là mô hình được thiết kế cho mục đích chính là cung cấp báo cáo.
Quá trình này đòi hỏi đầu tư thời gian đáng kể để phân tích các nguồn dữ liệu, thấu hiểu các quy trình nghiệp vụ, phân loại dữ liệu, và hình thành một hệ thống xác định để lưu trữ dữ liệu.
**Data lake** giữ dữ liệu ở trạng thái nguyên bản; khi có nhu cầu sử dụng dữ liệu để giải quyết các vấn đề kinh doanh, chỉ có những dữ liệu liên quan được chọn lọc và phân tích để đưa ra đáp án. Cách tiếp cận này được gọi là **"Schema on Read"** giúp tiết kiệm thời gian và chi phí cho doanh nghiệp.
### Scalability:
Data warehouse là một kho dữ liệu có cấu trúc chặt chẽ nên việc thay đổi cấu trúc theo nhu cầu của công ty rất tốn kém. Quá trình thay đổi đòi hỏi nhiều quy trình phức tạp, mất thời gian và tốn kém.
Data lake lại tận dụng tính linh hoạt của dữ liệu, bởi vì dữ liệu được lưu trữ ở dạng thô và luôn dễ dàng để truy cập, cho phép tái cấu trúc mà không có trở ngại nào.