Professional Documents
Culture Documents
Correct DW
Correct DW
Fact Table:
Sales:
Date_key (foreign key to Date dimension)
Customer_key (foreign key to Customer dimension)
Product_key (foreign key to Product dimension)
Turnover
Quantity
Rating
Dimension Tables:
Date:
Date_key (primary key)
Date
Day
Month
Year
Customer:
Customer_key (primary key)
Customer_number
Name
Telephone_number
Address
Product:
Product_key (primary key)
Reference
Name
Price
Justification:
The fact table is "Sales" because it contains the measures (turnover, quantity,
rating) and foreign keys to the related dimensions (Date, Customer, Product).
The dimensions are Date, Customer, and Product. These dimensions provide
context to the sales data and are used for slicing, dicing, and analyzing the
sales information from different perspectives.
In a snowflake schema, dimension tables are normalized into multiple related tables,
creating a hierarchical structure. Here's how the schema can be modified:
Dimension Tables:
Date:
Date_key (primary key)
Date
Day
Month
Year
Customer:
Customer_key (primary key)
Customer_number
Name
Telephone_number
Address
Product:
Product_key (primary key)
Reference
Name
Price
Date:
Date_key (primary key)
Date
Day_key (foreign key to Day dimension)
Month_key (foreign key to Month dimension)
Year_key (foreign key to Year dimension)
Day:
Day_key (primary key)
Day
Month:
Month_key (primary key)
Month
Year:
Year_key (primary key)
Year
The Date dimension is normalized into Day, Month, and Year tables to explicitly
model the hierarchy of date attributes.
Each level of the date hierarchy has its own dimension table, linked through foreign
key relationships.
This allows for more efficient storage and potentially better performance for queries
involving date hierarchies.
Ex2 :
Fact Table:
Exam Results:
Date_key (foreign key to Date dimension)
Student_key (foreign key to Student dimension)
Course_key (foreign key to Course dimension)
Exam_type
Grade
Dimension Tables:
Date:
Date_key (primary key)
Date
Day
Month
Year
Student:
Student_key (primary key)
idEtu
Last_name
First_name
Date_of_birth
Address
Specialty_of_Baccalaureate
Course:
Course_key (primary key)
idC
Course_name
Training_course_associated
Teacher:
Teacher_key (primary key)
idEns
Last_name
First_name
Specialty
Number_of_hours
Justification:
The fact table is "Exam Results" because it contains the measures (grade) and
foreign keys to the related dimensions (Date, Student, Course).
The dimensions are Date, Student, Course, and Teacher. These dimensions
provide context to the exam results data and are used for slicing, dicing, and
analyzing the exam results from different perspectives.
In a snowflake schema, dimension tables are normalized into multiple related tables,
creating a hierarchical structure. Here's how the schema can be modified:
Dimension Tables:
Date:
Date_key (primary key)
Date
Day_key (foreign key to Day dimension)
Month_key (foreign key to Month dimension)
Year_key (foreign key to Year dimension)
Student:
Student_key (primary key)
idEtu
Last_name
First_name
Date_of_birth
Address
Specialty_of_Baccalaureate
Course:
Course_key (primary key)
idC
Course_name
Training_course_associated
Teacher:
Teacher_key (primary key)
idEns
Last_name
First_name
Specialty
Number_of_hours
EX3 :
Ex4 :
To draw the graph of the cuboids from the multidimensional diagram provided, we
need to identify the dimensions and hierarchies involved. Based on the description,
the dimensions are "Machine Component" and "Factory Unit". Let's represent the
possible cuboids:
The hierarchy within each dimension can lead to additional levels of granularity in the
cuboids. However, without specific details about the hierarchies within each
dimension, we can represent the basic structure of the cuboids as follows:
Ex5
To perform the analysis operations described using OLAP operators, we can use
operations such as slicing, dicing, and drilling down. Let's express each operation and
display the resulting tables:
1. Analysis Operations:
The duration of outages per month, per component, and per unit:
OLAP Operation: Slice by month, component, and unit.
Resulting Table:
Month Component Unit Outage Duration (minutes)
January C1 Unit 1 xxx
February C1 Unit 1 xxx
... ... ... ...
Month Component Unit Outage Duration (minutes)
December C3 Unit 2 xxx
The duration of breakdowns per year, per component, and per unit:
OLAP Operation: Slice by year, component, and unit.
Resulting Table:
Year Component Unit Breakdown Duration (minutes)
2015 C1 Unit 1 xxx
2015 C2 Unit 1 xxx
... ... ... ...
2016 C3 Unit 2 xxx
The duration of breakdowns per year and per unit:
OLAP Operation: Slice by year and unit.
Resulting Table:
Year Unit Breakdown Duration (minutes)
2015 Unit 1 xxx
2016 Unit 1 xxx
... ... ...
2015 Unit 2 xxx
The duration of outages per unit:
OLAP Operation: Slice by unit.
Resulting Table:
Unit Outage Duration (minutes)
Unit 1 xxx
Unit 2 xxx
... ...
The duration of breakdowns per machine:
OLAP Operation: Drill down by machine (Component).
Resulting Table:
Component Breakdown Duration (minutes)
C1 xxx
C2 xxx
C3 xxx
... ...
The duration of breakdowns per component:
OLAP Operation: Drill down by component.
Resulting Table:
Component Breakdown Duration (minutes)
C1 xxx
C2 xxx
C3 xxx
... ...
The duration of outages per month, per component, and per unit:
OLAP Operation: Slice by month, component, and unit.
Resulting Table:
Month Component Unit Outage Duration (minutes)
January C1 Unit 1 xxx
February C1 Unit 1 xxx
... ... ... ...
December C3 Unit 2 xxx
The duration of breakdowns of components C1 and C3 during the month
January 2015 of the first unit:
OLAP Operation: Slice by month (January 2015), component (C1, C3), and unit
(first unit).
Resulting Table:
Component Unit Breakdown Duration (minutes)
C1 Unit 1 xxx
C3 Unit 1 xxx
2. Modifying the Display:
Present the component machines above the units:
OLAP Operation: Pivot the table to have the Component column above the
Unit column.
Resulting Table:
Component Unit Outage Duration (minutes)
C1 Unit 1 xxx
C2 Unit 1 xxx
C3 Unit 1 xxx
... ... ...
Present the units vertically in place of the dates and place the dates
below the machines:
OLAP Operation: Pivot the table to have the Unit column vertical and the
Date (Month) column below the machines (Components).
Resulting Table:
Unit C1 - Outage C2 - Outage C3 - Outage ...
Unit 1 xxx xxx xxx ...
Unit 2 xxx xxx xxx ...
... ... ... ... ...
Month January January January ...
These OLAP operations and resulting tables allow us to analyze and visualize the data
from the multidimensional cube C effectively.