Imagine you own a supermarket with branches in Lagos, Ibadan, and Abuja. Every day, your business collects information about customers, products, sales, payments, and employees.
As the business grows, the amount of information also increases. You need a good way to organise this information so that you can easily find it and use it to make business decisions.
This is where Data Warehouse Design becomes important.
Data warehouse design is the process of planning how information will be organised, stored, connected, and accessed inside a data warehouse.
A good design makes it easier for businesses to:
Data modelling is the process of creating a plan that shows how data will be organised and how different pieces of information are connected.
Think of building a house. Before construction begins, an architect creates a drawing that shows where the rooms, doors, windows, and other parts will be located.
Data modelling works in a similar way. It provides a structure that shows how information should be stored and connected.
Imagine a supermarket wants to store information about its customers and their purchases.
The business may organise its information into two tables:
| Customer ID | Customer Name | City |
|---|---|---|
| 101 | Ada | Lagos |
| 102 | John | Ibadan |
| 103 | Mary | Abuja |
| Sales ID | Customer ID | Amount (โฆ) |
|---|---|---|
| 5001 | 101 | 15000 |
| 5002 | 102 | 20000 |
| 5003 | 101 | 8000 |
The Customer ID connects the two tables. This allows the supermarket to identify which customer made each purchase.
Data modelling is usually discussed at three main levels.
A conceptual data model provides a simple overview of the important information a business needs to store.
It focuses on the main business objects and how they relate to one another. It does not include detailed technical information.
Example: A supermarket may identify these important objects:
A logical data model provides more detail about the information and how different data items are connected.
It may show:
Example: A customer table may contain Customer ID, Customer Name, Phone Number, and City.
A physical data model explains how information will actually be stored in a database system.
It includes technical details such as:
Example: The Customer ID field may be stored as an integer, while the Customer Name field may be stored as VARCHAR(100).
Two important building blocks in dimensional data modelling are Fact Tables and Dimension Tables.
A fact table stores measurable business activities or events.
Examples include:
A fact table usually contains numerical information and keys that connect it to dimension tables.
Example: A supermarket sales fact table may look like this:
| Sales ID | Customer ID | Product ID | Quantity | Amount (โฆ) |
|---|---|---|---|---|
| 1 | 101 | 201 | 2 | 10000 |
| 2 | 102 | 202 | 3 | 15000 |
| 3 | 101 | 203 | 1 | 8000 |
A dimension table stores descriptive information that helps people understand the facts.
Examples include:
Example: A product dimension table may look like this:
| Product ID | Product Name | Category |
|---|---|---|
| 201 | Rice | Food |
| 202 | Milk | Drinks |
| 203 | Soap | Household |
Dimension tables provide the details needed to understand and analyse the information in a fact table.
A Star Schema is a common way of organising data in a data warehouse.
It contains one central fact table connected to several dimension tables.
It is called a star schema because the arrangement can look like a star, with the fact table in the centre and dimension tables around it.
Customer ID
Name
City
Product ID
Name
Category
Customer ID
Product ID
Date ID
Sales Amount
Quantity
Date ID
Month
Year
Store ID
Branch Name
Location
Note: The dimension tables connect to the central sales fact table through matching keys.
A Snowflake Schema is another way of organising data in a data warehouse.
It is similar to a star schema, but some dimension tables are divided into smaller related tables.
For example, instead of keeping all product information in one table, a business may separate product details and product categories into different tables.
A supermarket may organise product information like this:
| Star Schema | Snowflake Schema |
|---|---|
| Uses a central fact table with dimension tables. | Uses a central fact table with more divided dimension structures. |
| Usually has fewer tables. | Usually has more tables. |
| Easier for beginners to understand. | Can be more complex to understand. |
| Often requires fewer joins. | May require more joins. |
Both designs can be useful. The best choice depends on the organisation's data and reporting needs.
Keys help databases identify records and connect information stored in different tables.
A primary key is a field that uniquely identifies each record in a table.
Example: In a customer table, Customer ID can be used as the primary key because every customer should have a different ID.
A foreign key is a field in one table that refers to a key in another table. It helps connect related information.
Example: Customer ID in a sales table can refer to Customer ID in the customer table.
Relationships explain how records in different tables are connected.
Common database relationships include:
Example: One customer can make many purchases. This is a one-to-many relationship between customers and sales.
Before designing a data warehouse, businesses should understand what they want to achieve.
Some important things to consider include:
A good design should support the current needs of a business and allow room for future growth.
Imagine you are helping a supermarket with branches in Lagos, Ibadan, and Abuja. The supermarket wants to understand its sales performance.
Identify the information the supermarket should store in its data warehouse.
Use the following suggested tables:
Challenge: Explain how the supermarket can use these tables to find its best-selling products, highest-performing branches, and total monthly sales.
| Term | Meaning |
|---|---|
| Data Warehouse Design | Planning how information will be organised and stored. |
| Data Modelling | Creating a plan that shows how data is structured and connected. |
| Conceptual Model | A high-level view of important business information. |
| Logical Model | A detailed description of data structures and relationships. |
| Physical Model | Shows how data is actually stored in a database. |
| Fact Table | Stores measurable business activities. |
| Dimension Table | Stores descriptive information used to analyse facts. |
| Star Schema | A design with a central fact table connected to dimension tables. |
| Snowflake Schema | A design where dimension information is divided into related tables. |
| Primary Key | A field that uniquely identifies a record. |
| Foreign Key | A field that connects one table to another. |
In this module, you have learned that data warehouse design helps businesses organise information for reporting and analysis.
You have also learned about:
Remember: A good data warehouse design makes business information easier to organise, understand, and analyse.
Answer the following questions to test your understanding.
Imagine you are designing a data warehouse for a Nigerian university.
The university wants to analyse student registrations, examination results, course enrolments, departments, and school fees.
Identify at least four dimension tables and one fact table that could help the university organise this information.
Also explain how the university could use the data warehouse to identify departments with the highest number of registered students.