1 Introduction To Data Warehousing

Data Warehousing and Data Mining · Unit 1 · 5 hrs

Introduction to Data Warehousing

Exam-focused notes for Introduction to Data Warehousing (Data Warehousing and Data Mining, CSC420): what the TU syllabus asks and how it has actually been tested, with 15 solved past questions from this unit.

Introduction to Data Warehousing in short

This unit introduces the data warehouse as the historical, subject oriented store that feeds analytical decision making. It follows data from its creation through to its use inside a warehouse, contrasts a warehouse with the everyday operational database that runs a business, and covers the multidimensional model, the standard OLAP operations, warehouse architecture, and the schemas used to design one.

Introduction to Data Warehousing: notes

Lifecycle of data

The data lifecycle describes the stages any piece of organizational data passes through, from the moment it is created to the moment it is finally disposed of. Five stages are usually distinguished. Creation is when data enters the organization, either through manual entry or through capture devices such as sensors. Storage follows creation: the data is placed under a security policy and a backup and recovery plan so that it survives hardware failure. Usage is the working phase, in which data is viewed, modified, saved and sometimes shared outside the organization to support day to day activity. Archival removes data from the active production environment while keeping a protected copy that can be brought back into use later if it is needed again. Destruction is the final stage, in which every remaining copy of a data item, including any copy held in archive storage, is permanently removed. A data warehouse sits mainly in the storage and usage stages of this lifecycle, since its purpose is to keep large volumes of already-created data available for analysis over a long horizon.

Types of data

Data that an organization holds falls into three broad types based on how rigidly it is organized. Structured data is the easiest to search and manage because it is held in rows and columns, with every value mapped into a fixed, pre-defined field; relational databases and SQL are the natural tools for it. Unstructured data has no associated data model and cannot be placed into a row-column table, examples being photographs, video, audio and free text; it is harder to search and analyze, and is typically stored in NoSQL databases or in a data warehouse's raw zones rather than a relational schema. Semi-structured data sits between the two: it carries some organizing tags but still has internal variability, the standard example being an email message, whose sender, receiver and timestamp are structured fields while the body of the message is unstructured text.

Data warehouse and data warehousing

A data warehouse is a repository that collects information from multiple source systems and stores it, together with its history, to support the decision maker who needs to model and analyze data rather than run day to day transactions. It forms the core of a Business Intelligence system built for reporting and analysis. Data warehousing is the process of building and maintaining that warehouse: it depends on ETL (extract, transform, load), the process that pulls data out of the different source systems, reshapes it into a common form, and loads it into the warehouse, and it requires the warehouse to be refreshed periodically as new source data arrives.

A data warehouse is characterized by four properties, due originally to Bill Inmon. It is subject oriented: rather than modelling the ongoing operations of the whole organization, it is built around a specific subject such as customer, product or sales, including only the data relevant to that subject and excluding what is not useful for understanding it. It is time variant: unlike an operational system, which typically keeps only the most recent value of a record, a warehouse retains historical data so that a value from three, six or twelve months ago can still be retrieved. It is integrated: it draws together heterogeneous sources such as relational databases, flat files and transaction logs, and the data must be cleaned and transformed during loading so that naming conventions and attribute types agree across sources. It is non-volatile: once data lands in the warehouse it is not overwritten in place, a new version is appended instead, so history is never lost, in contrast to an operational database that is constantly updated.

What this unit covers

  • Lifecycle of data
  • Types of data
  • Data warehouse and data warehousing
  • Differences between operational database and data warehouse
  • A multidimensional data model
  • OLAP operation in multidimensional data model
  • Conceptual modeling of data warehouse
  • Architecture of data warehouse
  • Data warehouse implementation
  • Data marts
  • Components of data warehouse
  • Need for data warehousing
  • Trends in data warehousing

A multidimensional data model

2081 · 10 marks

When do we prefer trim mean for statistical description of data? Justify with an example. Describe about multi-dimensional data model and conceptual modeling of data warehouse.[10]

Show solved answer

Trim Mean for Statistical Description & Multidimensional Data Model / Conceptual Modeling of Data Warehouse


PART 1: Trim Mean - When to Prefer It and Justification

Definition of Trim Mean

The trimmed mean (trim mean) is a measure of central tendency calculated by removing a specified percentage of the smallest and largest values from a dataset before computing the arithmetic mean. If we trim p% from each end, it is called a p% trimmed mean.

Formula:

$$\bar{x}{trim} = \frac{1}{n - 2k} \sum{i=k+1}^{n-k} x_{(i)}$$

where:

  • $x_{(i)}$ are the sorted (ordered) values
  • $k = \lfloor p \times n / 100 \rfloor$ is the number of values trimmed from each end
  • $n$ is the total number of observations

When Do We Prefer Trim Mean?

We prefer the trimmed mean over the ordinary arithmetic mean in the following situations:

  1. Presence of Outliers: When the dataset contains extreme values (outliers) that distort the arithmetic mean, the trim mean provides a more robust and representative central value.

  2. Skewed Distributions: When data is heavily skewed (positively or negatively), the ordinary mean is pulled toward the tail. The trim mean reduces this effect.

  3. Noisy or Erroneous Data: In real-world data collection, some values may be recorded incorrectly or represent measurement errors. Trimming removes these suspicious extreme values.

  4. When Median is Too Extreme: The median ignores all values except the middle one, while the arithmetic mean is too sensitive to extremes. The trim mean offers a balance between the two - it is more robust than the mean but uses more data than the median.

  5. Data Mining and Statistical Description: In data preprocessing for data mining, when describing large datasets with potential noise, the trim mean gives a cleaner summary statistic.


Justification with Example

Example:

Consider the monthly salaries (in thousands) of 10 employees:

$${12, 14, 15, 16, 17, 18, 19, 20, 21, 150}$$

Step 1: Compute the Arithmetic Mean

$$\bar{x} = \frac{12 + 14 + 15 + 16 + 17 + 18 + 19 + 20 + 21 + 150}{10} = \frac{302}{10} = 30.2$$

The mean is 30.2, but 9 out of 10 employees earn between 12 and 21. The value 150 is clearly an outlier (perhaps the CEO's salary), and it has inflated the mean significantly.

Step 2: Compute the 10% Trimmed Mean

  • Trim 10% from each end: $k = 0.10 \times 10 = 1$ value removed from each side
  • Remove the lowest value: 12
  • Remove the highest value: 150
  • Remaining values: ${14, 15, 16, 17, 18, 19, 20, 21}$

$$\bar{x}_{10%} = \frac{14 + 15 + 16 + 17 + 18 + 19 + 20 + 21}{8} = \frac{140}{8} = 17.5$$

Conclusion: The trimmed mean of 17.5 is far more representative of the typical employee salary than the arithmetic mean of 30.2. This justifies using the trim mean when outliers are present.


PART 2: Multidimensional Data Model

Definition

A multidimensional data model is a data model that organizes data in multiple dimensions to facilitate complex analytical queries and reporting. It is the foundation of OLAP (Online Analytical Processing) systems and data warehouses.

  • Data is viewed as a data cube with multiple dimensions.
  • Each dimension represents a perspective or entity of interest (e.g., Time, Location, Product).
  • The model is typically organized around a central theme (e.g., Sales), represented by a fact table.
  • Facts are numerical measures such as sales amount, units sold, profit, etc.
  • Each dimension may have a dimension table associated with it.

Key Components

ComponentDescription
Fact TableCentral table containing numerical measures (facts)
Dimension TableTables describing the dimensions (e.g., Time, Product, Location)
Measures/FactsQuantitative data: sales, revenue, units sold
DimensionsQualitative context: who, what, when, where

OLAP Operations in Multidimensional Data Model

1. Roll-Up (Consolidation / Aggregation)

  • Generates summary from lower level to higher level.
  • Can be performed by:
    • Reducing dimensions
    • Climbing up a concept hierarchy
  • Concept Hierarchy: A system of grouping things based on their order level. For example, from daily summary, weekly summary is generated; from weekly, monthly summary is generated.
  • Example: Roll-up on location from cities to countries - individual city sales are aggregated into country-level totals.

2. Drill-Down

  • The reverse of roll-up; navigates from summary data to more detailed data.
  • Example: From yearly sales, drill down to quarterly, then monthly sales.

3. Slice

  • Selects one particular dimension from a data cube, resulting in a sub-cube.
  • Example: Slice on Time = "Q1 2024" to get all sales data for Q1 only.

4. Dice

  • Selects two or more dimensions from a data cube to produce a sub-cube.
  • Example: Dice on Location = {Nepal, India} AND Time = {Q1, Q2}.

5. Pivot (Rotate)

  • Rotates the data axes to provide an alternative presentation of data.
  • Example: Swapping rows and columns in a cross-tabulation.

PART 3: Conceptual Modeling of Data Warehouse

Definition

A **conceptual

Open this answer on its own page →

2078 · 5 marks

Differentiate between star schema and snow flake schema. List any two methods for data normalization. [5]

Basis Star Schema Snowflake Schema --------- Structure A central fact table is connected directly to dimension tables, forming a star shape A variant of star schema where some dimension tables are further normalized and split into additional tables, forming a snowflake shape Normalization Dimensi...

Open this answer on its own page →

2076 · 5 marks

How multidimensional data model helps in retrieving information? Explain with suitable example. [5]

A multidimensional data model organizes data around a central theme (such as sales) represented by a fact table. Facts are numerical measures (e.g., sales amount, units sold). Each dimension (e.g., time, location, product) may have an associated dimension table. This model allows analysts to view...

Open this answer on its own page →

2075 · 5 marks

How different schema are used to model data warehouse? Explain. [5]

A schema is a logical description of the entire data warehouse, including the name and description of records and aggregates. The goal of conceptual data warehouse modeling is to develop a schema for logical representation of data stored in the data warehouse. The three main schemas used for conc...

Open this answer on its own page →

OLAP operation in multidimensional data model

2081 · 5 marks

List any two OLAP operations with example. How do you compute rule coverage and rule accuracy? [5]

Show solved answer

OLAP Operations and Rule Coverage/Accuracy


Part 1: Two OLAP Operations with Examples

1. Roll-up (Consolidation / Aggregation)

Roll-up generates a summary from a lower level to a higher level. It can be performed by:

  • Reducing dimensions, or
  • Climbing up a concept hierarchy

Example: In the location dimension, data can be rolled up from city level to country level. For instance, sales data for cities like Kathmandu, Pokhara, and Biratnagar are aggregated (summed) to give total sales for Nepal as a country.

Concept hierarchy: Day → Week → Month → Year


2. Drill-down (Opposite of Roll-up)

Drill-down navigates from higher-level summarized data to lower-level detailed data. It is the reverse of roll-up, either by stepping down a concept hierarchy or by introducing additional dimensions.

Example: If we have quarterly sales data for a country, we can drill down to view monthly sales for each city within that country. This gives more granular, detailed information.


Part 2: Rule Coverage and Rule Accuracy

The quality of an association/classification rule R is measured by two factors: coverage and accuracy.

Let the rule be of the form:

R: A => B (If condition A, then class/consequence B)

Let:

  • n = total number of tuples in the dataset
  • nA = number of tuples satisfying condition A (antecedent)
  • nA,B = number of tuples satisfying both A and B

Rule Coverage

Coverage measures how often the rule applies to the dataset. It is the fraction of tuples that satisfy the antecedent of the rule.

$$\text{Coverage}(R) = \frac{n_A}{n}$$

Example: If a dataset has 1000 tuples and 400 tuples satisfy condition A, then:

$$\text{Coverage}(R) = \frac{400}{1000} = 0.4 = 40%$$


Rule Accuracy (Confidence)

Accuracy measures how often the rule is correct. It is the fraction of tuples satisfying the antecedent that also satisfy the consequent.

$$\text{Accuracy}(R) = \frac{n_{A,B}}{n_A}$$

Example: Out of the 400 tuples satisfying condition A, suppose 300 also satisfy B, then:

$$\text{Accuracy}(R) = \frac{300}{400} = 0.75 = 75%$$


Summary Table

MeasureFormulaMeaning
Coverage$n_A / n$How often the rule's condition applies
Accuracy$n_{A,B} / n_A$How often the rule is correct when it applies

A good rule should have both high coverage (applies to many tuples) and high accuracy (is correct most of the time).

Open this answer on its own page →

2080 · 5 marks

Explain the OLAP operations with examples. [5]

Show solved answer

OLAP Operations in Multidimensional Data Model

OLAP (Online Analytical Processing) is a technology used to perform multidimensional analysis on large volumes of data stored in a data warehouse. OLAP operations are performed on a data cube, which organizes data along multiple dimensions (e.g., time, location, product).

The key OLAP operations are described below:


1. Roll-Up (Drill-Up)

Roll-up is also known as consolidation or aggregation. It generates a summary by moving from a lower level to a higher level in a concept hierarchy, or by reducing dimensions.

Concept Hierarchy is a system of grouping things based on their order level.

Two ways to perform Roll-up:

  • Reducing dimensions
  • Climbing up the concept hierarchy

Example:

  • In the time dimension: Daily summary → Weekly summary → Monthly summary → Yearly summary
  • In the location dimension: City level data is aggregated (rolled up) to Country level data.

Rolling up on location means sales data for individual cities (e.g., Kathmandu, Pokhara) is aggregated to give total sales for Nepal (country level).


2. Drill-Down (Roll-Down)

Drill-down is the reverse of roll-up. It navigates from a higher level of summary to a lower level of detail by descending a concept hierarchy or adding new dimensions.

Example:

  • Moving from yearly sales data → quarterly sales → monthly sales → daily sales.
  • From country-level sales → city-level sales.

3. Slice

The slice operation selects one particular dimension from a data cube and provides a new sub-cube by fixing a single value for one dimension.

Example:

  • From a 3D cube with dimensions (Time, Location, Product), fixing Time = "Q1 2024" produces a 2D slice showing sales by Location and Product for Q1 2024 only.

4. Dice

The dice operation selects two or more dimensions from a data cube and provides a sub-cube by specifying a range or list of values for multiple dimensions.

Example:

  • Selecting: Location = {Kathmandu, Pokhara}, Time = {Q1, Q2}, Product = {Laptop}
  • This produces a smaller sub-cube from the original data cube.

5. Pivot (Rotate)

The pivot operation rotates the data axes of the cube to provide an alternative presentation of the data. It does not change the data but changes the orientation/view of the cube.

Example:

  • Swapping the Time axis with the Location axis to view data from a different angle, such as viewing sales by product across time instead of by location across time.

Summary Table

OperationDescriptionDirection
Roll-UpAggregates data; moves to higher levelBottom to Top
Drill-DownDetailed view; moves to lower levelTop to Bottom
SliceFixes one dimension; produces 2D viewSingle dimension filter
DiceFixes multiple dimensions; produces sub-cubeMulti-dimension filter
PivotRotates the data cube for alternate viewReorientation

These operations allow analysts and decision-makers to view data from multiple perspectives, enabling effective business intelligence and decision support.

Open this answer on its own page →

2079 · 10 marks

Why OLAP operations are used? Discuss various OLAP operation with suitable example of each.[10]

Show solved answer

OLAP Operations in Multidimensional Data Model

Why OLAP Operations Are Used

OLAP (Online Analytical Processing) operations are used to analyze multidimensional data stored in a data warehouse. The key reasons for using OLAP operations are:

  • To view and analyze data from multiple perspectives (dimensions)
  • To generate summaries and aggregations at different levels of detail
  • To help managers and analysts make better business decisions
  • To allow interactive exploration of data by drilling into details or rolling up to summaries
  • To support fast query processing on large volumes of historical data
  • To enable users to slice, filter, and pivot data without writing complex SQL queries

A multidimensional data model is organized around a central theme (e.g., Sales) represented by a fact table containing numerical measures (e.g., sales amount, units sold), and dimension tables (e.g., Time, Location, Product).


OLAP Operations

1. Roll-Up (Consolidation / Aggregation)

Definition: Roll-up generates a summary by moving from a lower level to a higher level in a concept hierarchy, or by reducing dimensions.

Two ways to perform Roll-up:

  • Climbing up a concept hierarchy
  • Reducing the number of dimensions

Concept Hierarchy Example (Time):

Daily --> Weekly --> Monthly --> Quarterly --> Yearly

Example:

Suppose we have sales data at the city level (Kathmandu, Pokhara, Butwal). A roll-up on the Location dimension climbs from cities to countries:

Location (City)Sales
Kathmandu5000
Pokhara3000
Butwal2000

After Roll-up (City --> Country):

Location (Country)Sales
Nepal10000

The data is aggregated (summed) at the country level, reducing detail.


2. Drill-Down (Reverse of Roll-Up)

Definition: Drill-down is the reverse of roll-up. It navigates from a higher level summary to a lower level detail, either by stepping down a concept hierarchy or by introducing additional dimensions.

Example:

Starting from yearly sales data, a drill-down on the Time dimension moves from year to quarter:

YearSales
202340000

After Drill-down (Year --> Quarter):

QuarterSales
Q18000
Q212000
Q310000
Q410000

This gives more detailed information for analysis.


3. Slice

Definition: Slice performs a selection on one dimension of the data cube, resulting in a sub-cube. It fixes one dimension to a single value and returns the remaining dimensions.

Example:

Consider a 3D cube with dimensions: Time, Location, Product.

Slicing on Time = "Q1 2023" gives a 2D sub-cube showing sales for all locations and all products only for Q1 2023:

Location \ ProductTVLaptopPhone
Kathmandu200030001500
Pokhara10002000800

One dimension (Time) is fixed; the rest are free.


4. Dice

Definition: Dice performs a selection on two or more dimensions of the data cube, resulting in a smaller sub-cube. It is like applying multiple conditions simultaneously.

Example:

From the same 3D cube (Time, Location, Product), dicing with:

  • Time = "Q1 2023" OR "Q2 2023"
  • Location = "Kathmandu" OR "Pokhara"
  • Product = "Laptop" OR "Phone"

This produces a smaller sub-cube containing only the combinations that satisfy all three conditions, rather than a single slice.

TimeLocationProductSales
Q1KathmanduLaptop3000
Q1KathmanduPhone1500
Q1PokharaLaptop2000
Q2KathmanduLaptop3500
............

5. Pivot (Rotate)

Definition: Pivot (also called rotate) rotates the data axes to provide an alternative presentation of the data. It changes the orientation of the data cube to view it from a different angle without changing the data itself.

Example:

Original view (rows = Product, columns = Location):

Product \ LocationKathmanduPokhara
Laptop30002000
Phone1500800

After Pivot (rows = Location, columns = Product):

Location \ ProductLaptopPhone
Kathmandu30001500
Pokhara2000800

The data is the same but the perspective has changed, making it easier to analyze from a different angle.


Summary Table

OperationDescriptionDirection
Roll-UpAggregates data from lower to higher levelBottom --> Top
Drill-DownExpands data from higher to lower levelTop --> Bottom
SliceSelects one value for one dimensionFixes 1 dimension
DiceSelects values for two or more dimensionsFixes 2+ dimensions
PivotRotates the data cube for alternate viewChanges orientation
Open this answer on its own page →

2075 · 5 marks

Explain OLAP operations with examples. [5]

OLAP (Online Analytical Processing) allows users to analyze multidimensional data from multiple perspectives. Data is organized in a data cube with dimensions (e.g., location, time, product) and facts (e.g., sales amount, units sold). The major OLAP operations are described below: --- Roll-up is ...

Open this answer on its own page →

Data marts

2080 · 10 marks

Why the concept of data mart is important? Discuss different data warehouse schema with examples.[10]

--- "A data mart is a subset of a data warehouse focused on a particular line of business, department, or subject area." In other words, a data mart is a smaller, focused slice of the larger data warehouse that is tailored to the needs of a specific group of users or a specific business function....

Open this answer on its own page →

2079 · 5 marks

Write down short notes on: a. Data Mart b. Market Basket Analysis [5]

--- A Data Mart is a subset of a data warehouse that is focused on a specific subject area, department, or business function (such as sales, finance, or marketing). While a data warehouse is a central repository collecting information from multiple sources across an entire organization, a data ma...

Open this answer on its own page →

Differences between operational database and data warehouse

2076 · 10 marks

Do pattern and information refer to same aspect? Justify. Differentiate between data warehouse and operational database.[10]

--- No, pattern and information do not refer to the same aspect. They are related but distinct concepts in the context of Knowledge Discovery from Data (KDD) and Data Mining. A pattern is a structural regularity, relationship, or trend discovered from raw data by applying intelligent data mining ...

Open this answer on its own page →

Data warehouse and data warehousing

2076 · 5 marks

Explain the four characteristics of data warehouse. [5]

A data warehouse is a repository of information collected from multiple sources that stores historical data and provides support for decision-makers for data analysis and reporting. The four key characteristics of a data warehouse are: --- A data warehouse is organized around major subjects such ...

Open this answer on its own page →

Architecture of data warehouse

2076 · 5 marks

Compare the OLAP servers, ROLAP, MOLAP and HOLAP. [5]

As mentioned in the notes, the middle tier of a data warehouse architecture contains the OLAP Server, which can be implemented using ROLAP, MOLAP, or HOLAP. These are three different approaches to storing and processing multidimensional data for analytical queries. --- - ROLAP implements OLAP fun...

Open this answer on its own page →

Data warehouse implementation

2076 · 5 marks

What does data warehouse tuning mean? Describe the parameters. [5]

Data warehouse tuning refers to the process of optimizing the performance of a data warehouse system so that queries execute faster, data loading (ETL) is more efficient, and overall system resources are utilized effectively. Since a data warehouse handles large volumes of historical data and com...

Open this answer on its own page →

Components of data warehouse

2075 · 10 marks

Describe how bitmap and join indexing are used to represent OLAP data. Explain the different components of data warehouse.[10]

--- Definition: A bitmap index is a special type of index that uses bit vectors (arrays of 0s and 1s) to represent the presence or absence of a value for each row in a table. It is highly efficient for OLAP queries involving low-cardinality attributes (attributes with few distinct values), such a...

Open this answer on its own page →