Day-to-day systems record transactions. Organisations also need to study that history to make decisions. Data warehousing, OLAP and data mining serve that need.
OLTP versus data warehouse
| OLTP (operational) | Data warehouse | |
|---|---|---|
| Purpose | Run daily work | Support analysis and decisions |
| Data | Current, detailed | Historical, summarised |
| Operations | Many short inserts and updates | Fewer, large read queries |
| Design | Normalised | Often denormalised (star schema) |
Data warehouse
A data warehouse is a central store of integrated, historical data collected from many sources. The usual steps are ETL: Extract data from sources, Transform it (clean, match formats), and Load it into the warehouse. Its data is subject-oriented, integrated, time-variant and non-volatile (not changed once loaded).
A star schema has a central fact table (sales amount, quantity) joined to dimension tables (date, product, store, customer).
OLAP
Online Analytical Processing lets users look at the same numbers from many viewpoints, using a multi-dimensional cube.
- Roll-up: move to a higher level, such as from month to year.
- Drill-down: move to more detail, such as from year to month.
- Slice: fix one dimension, such as sales for 2025 only.
- Dice: pick a sub-cube with several conditions.
- Pivot: rotate the view.
SELECT region, product, SUM(amount)
FROM sales
GROUP BY region, product WITH ROLLUP; -- ROLLUP syntax varies by DBMS
Data mining
Data mining finds useful patterns in large data sets. Typical tasks:
- Association: items bought together (bread and butter).
- Classification: put records in classes (loan approved or not).
- Clustering: group similar records without labels (customer segments).
- Prediction and anomaly detection: forecast sales; spot fraud.
Mining is one step of knowledge discovery from data: clean, integrate, select, transform, mine, evaluate and present.
Common mistakes
- Treating a warehouse as a bigger copy of the operational database. It is built for a different purpose.
- Confusing OLAP (analysing summaries) with data mining (discovering patterns automatically).
Practice questions
- Differentiate OLTP and a data warehouse.
- What is ETL?
- Define roll-up, drill-down, slice and dice.
- What is a star schema?
- Name three data mining tasks with an example of each.
Answers to the practice questions
- OLTP runs daily transactions on current data; a warehouse stores historical data for analysis.
- Extract, transform and load: collecting, cleaning and loading data into the warehouse.
- Roll-up: go to a higher summary; drill-down: go to detail; slice: fix one dimension; dice: select a sub-cube.
- A central fact table joined to dimension tables.
- Association (items bought together), classification (loan approval), clustering (customer segments).
Sources
- Official BCA syllabus Database Management Systems, course code CC202, Unit IV
- Raghu Ramakrishnan and Johannes Gehrke, Database Management Systems, 3rd edition, McGraw-Hill
