SlideShare a Scribd company logo
Intro to Data Warehousing
Normalization
-
1
Ch Anwar ul Hassan (Lecturer)
Department of Computer Science and Software
Engineering
Capital University of Sciences & Technology, Islamabad
Pakistan
anwarchaudary@gmail.com
๏‚ง A step by step process to produce more efficient
and accurate database design
๏‚ง Purpose is to produce an anomaly free design
What is Normalization
๏‚ง An inconsistent, incomplete or incorrect state of
database
๏‚ง Four types of anomalies are of concern here;
๏‚ง Redundancy
๏‚ง Insertion
๏‚ง Deletion
๏‚ง Updation
Anomalies
Anomalies
Redundancy, Insertion, Deletion, Updation
-
5
Normalization
What are the goals of normalization?
๏‚ง Eliminate redundant data.
๏‚ง Ensure data dependencies make sense.
What is the result of normalization?
๏‚ง Normalized design makes the maintenance of
database easier
๏‚ง Different forms or levels of normalization
๏‚ง Called first, second, third and so on forms
๏‚ง Each form has got certain conditions
๏‚ง If a table fulfils the condition(s) for a normal
form then the table is in that normal form
What are the levels of normalization?
๏‚ง A relation is in first normal form iff every attribute
in every tuple contains an atomic value
๏‚ง There is no multivalued (repeating group) in the
relation
๏‚ง A column should contain the value of same type
๏‚ง Each column should have unique name
๏‚ง Order in which data is saved doesnโ€™t matter
Normalization: 1NF
โ€ข Atomic Value
Normalization: 1NF
โ€ข Value of same type
โ€ข unique column name
โ€ข Data store order
Normalization: 1NF
-
10
Normalization
SID: Student ID
Degree: Registered as BS or MS student
Campus: City where campus is located
Course: Course taken
Marks: Score out of max of 50
Consider a student database system to be developed for a multi-campus university,
such that it specializes in one degree program at a campus i.e. BS, MS or PhD.
SID Degree Campus Course Marks
1 BS Islamabad CS-101 30
1 BS Islamabad CS-102 20
1 BS Islamabad CS-103 40
1 BS Islamabad CS-104 20
1 BS Islamabad CS-105 10
1 BS Islamabad CS-106 10
2 MS Lahore CS-101 30
2 MS Lahore CS-102 40
3 MS Lahore CS-102 20
4 BS Islamabad CS-102 20
4 BS Islamabad CS-104 30
4 BS Islamabad CS-105 40
-
11
Normalization: 1NF
Only contains atomic values, BUT also contains redundant data.
40CS-105IslamabadBS4
30CS-104IslamabadBS4
20CS-102IslamabadBS4
20CS-102LahoreMS3
40CS-102LahoreMS2
30CS-101LahoreMS2
10CS-106IslamabadBS1
10CS-105IslamabadBS1
20CS-104IslamabadBS1
40CS-103IslamabadBS1
20CS-102IslamabadBS1
30CS-101IslamabadBS1
MarksCourseCampusDegreeSID
FIRST
-
12
Normalization: 1NF
Update anomalies
INSERT. Certain student with SID 5 got admission in a
different campus (say) Karachi cannot be added until the
student registers for a course.
DELETE. If student graduates and his/her corresponding
record is deleted, then all information about that student is
lost.
UPDATE. If student migrates from Islamabad campus to
Lahore campus (say) SID = 1, then six rows would have to be
updated with this new information.
๏‚ง A relation is in 2nd normal form iff it is in the
first normal form and all non key attributes
are fully functionally dependent on key, that
is, there is no partial dependency
Normalization: 2NF
-
14
Normalization: 2NF
Every non-key column is fully dependent on the PK
FIRST is in 1NF but not in 2NF because degree and campus are
functionally dependent upon only on the column SID of the composite
key (SID, course). This can be illustrated by listing the functional
dependencies in the table:
SID โ€”> campus, degree
campus โ€”> degree
(SID, Course) โ€”> Marks
To transform the table FIRST into 2NF we move the columns SID, Degree and
Campus to a new table called REGISTRATION. The column SID becomes the
primary key of this new table.
SID & Campus are NOT unique
-
15
Normalization
SID: Student ID
Degree: Registered as BS or MS student
Campus: City where campus is located
Course: Course taken
Marks: Score out of max of 50
SID Degree Campus Course Marks
1 BS Islamabad CS-101 30
1 BS Islamabad CS-102 20
1 BS Islamabad CS-103 40
1 BS Islamabad CS-104 20
1 BS Islamabad CS-105 10
1 BS Islamabad CS-106 10
2 MS Lahore CS-101 30
2 MS Lahore CS-102 40
3 MS Lahore CS-102 20
4 BS Islamabad CS-102 20
4 BS Islamabad CS-104 30
4 BS Islamabad CS-105 40
-
16
Normalization: 2NF
SID Degree Campus
1 BS Islamabad
2 MS Lahore
3 MS Lahore
4 BS Islamabad
5 PhD Peshawar
SID Course Marks
1 CS-101 30
1 CS-102 20
1 CS-103 40
1 CS-104 20
1 CS-105 10
1 CS-106 10
2 CS-101 30
2 CS-102 40
3 CS-102 20
4 CS-102 20
4 CS-104 30
4 CS-105 40
REGISTRATION
PERFORMANCE
SID is now a PK
PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
-
17
Normalization: 2NF
Presence of modification anomalies for tables in 2NF.
For the table REGISTRATION, they are:
๏‚ง INSERT: Until a student gets registered in a degree
program, that program cannot be offered!
๏‚ง DELETE: Deleting any row from REGISTRATION destroys
all other facts in the table.
-
18
Normalization
SID Degree Campus
1 BS Islamabad
2 MS Lahore
3 MS Lahore
4 BS Islamabad
5 PhD Peshawar
SID Course Marks
1 CS-101 30
1 CS-102 20
1 CS-103 40
1 CS-104 20
1 CS-105 10
1 CS-106 10
2 CS-101 30
2 CS-102 40
3 CS-102 20
4 CS-102 20
4 CS-104 30
4 CS-105 40
REGISTRATION
PERFORMANCE
SID is now a PK
PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
-
19
Normalization: 3NF
All columns must be dependent only on the primary key.
Table PERFORMANCE is already in 3NF. The non-key column, marks, is fully
dependent upon the primary key (SID, degree).
REGISTRATION is in 2NF but not in 3NF because it contains a transitive
dependency.
A transitive dependency occurs when a non-key attribute is dependent on
another non-key attribute
The concept of a transitive dependency can be illustrated by showing the
functional dependencies in REGISTRATION:
REGISTRATION.SID โ€”> REGISTRATION.Degree
REGISTRATION.SID โ€”> REGISTRATION.Campus
REGISTRATION.Campus โ€”> REGISTRATION.Degree
Note that REGISTRATION.Degree is determined both by the primary key SID
and the non-key column campus.
-
20
Normalization: 3NF
To transform REGISTRATION into 3NF, we create a
new table called CAMPUS_DEGREE and move the
columns campus and degree into it.
Degree is deleted from the original table, campus is
left behind to serve as a foreign key to
CAMPUS_DEGREE, and the original table is
renamed to STUDENT_CAMPUS to reflect its
semantic meaning.
-
21
Normalization: 3NF
PeshawarPhD5
IslamabadBS4
LahoreMS3
LahoreMS2
IslamabadBS1
CampusDegreeSID
REGISTRATION
Peshawar5
Islamabad4
Lahore3
Lahore2
Islamabad1
CampusSID
STUDENT_CAMPUS
PhDPeshawar
MSLahore
BSIslamabad
DegreeCampus
CAMPUS_DEGREE
-
22
Normalization: 3NF
Removal of anomalies and improvement in
queries as follows:
๏‚ง INSERT: Able to first offer a degree program,
and then students registering in it.
๏‚ง UPDATE: Migrating students between
campuses by changing a single row.
๏‚ง DELETE: Deleting information about a course,
without deleting facts about all columns in the
record.
-
23
Normalization
Conclusions:
๏‚ง Normalization guidelines are cumulative.
๏‚ง Generally a good idea to only ensure 2NF.
๏‚ง 3NF is at the cost of simplicity and performance.
๏‚ง BCNF (3.5NF)
๏‚ง There is a 4NF with no multi-valued
dependencies.
๏‚ง There is also a 5NF.

More Related Content

Similar to Intro to Data warehousing lecture 03

Db presn(1)
Db presn(1)Db presn(1)
Db presn(1)
Aqsa Awan
ย 
4 the sql_standard
4 the  sql_standard4 the  sql_standard
4 the sql_standard
Utkarsh De
ย 
Dbms record
Dbms recordDbms record
Dbms record
Teja Bheemanapally
ย 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
Deependra35
ย 
Database normalisation
Database normalisationDatabase normalisation
SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6
Mahesh Vallampati
ย 
Normalization
NormalizationNormalization
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases SharingDeep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
Databricks
ย 
DARS Report
DARS ReportDARS Report
DARS Report
Samantha Swanson
ย 

Similar to Intro to Data warehousing lecture 03 (9)

Db presn(1)
Db presn(1)Db presn(1)
Db presn(1)
ย 
4 the sql_standard
4 the  sql_standard4 the  sql_standard
4 the sql_standard
ย 
Dbms record
Dbms recordDbms record
Dbms record
ย 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
ย 
Database normalisation
Database normalisationDatabase normalisation
Database normalisation
ย 
SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6SQL Optimization With Trace Data And Dbms Xplan V6
SQL Optimization With Trace Data And Dbms Xplan V6
ย 
Normalization
NormalizationNormalization
Normalization
ย 
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases SharingDeep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
Deep Dive of ADBMS Migration to Apache Sparkโ€”Use Cases Sharing
ย 
DARS Report
DARS ReportDARS Report
DARS Report
ย 

More from AnwarrChaudary

Intro to Data warehousing lecture 20
Intro to Data warehousing   lecture 20Intro to Data warehousing   lecture 20
Intro to Data warehousing lecture 20
AnwarrChaudary
ย 
Intro to Data warehousing lecture 19
Intro to Data warehousing   lecture 19Intro to Data warehousing   lecture 19
Intro to Data warehousing lecture 19
AnwarrChaudary
ย 
Intro to Data warehousing lecture 18
Intro to Data warehousing   lecture 18Intro to Data warehousing   lecture 18
Intro to Data warehousing lecture 18
AnwarrChaudary
ย 
Intro to Data warehousing lecture 17
Intro to Data warehousing   lecture 17Intro to Data warehousing   lecture 17
Intro to Data warehousing lecture 17
AnwarrChaudary
ย 
Intro to Data warehousing lecture 16
Intro to Data warehousing   lecture 16Intro to Data warehousing   lecture 16
Intro to Data warehousing lecture 16
AnwarrChaudary
ย 
Intro to Data warehousing lecture 15
Intro to Data warehousing   lecture 15Intro to Data warehousing   lecture 15
Intro to Data warehousing lecture 15
AnwarrChaudary
ย 
Intro to Data warehousing lecture 14
Intro to Data warehousing   lecture 14Intro to Data warehousing   lecture 14
Intro to Data warehousing lecture 14
AnwarrChaudary
ย 
Intro to Data warehousing lecture 13
Intro to Data warehousing   lecture 13Intro to Data warehousing   lecture 13
Intro to Data warehousing lecture 13
AnwarrChaudary
ย 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
AnwarrChaudary
ย 
Intro to Data warehousing lecture 11
Intro to Data warehousing   lecture 11Intro to Data warehousing   lecture 11
Intro to Data warehousing lecture 11
AnwarrChaudary
ย 
Intro to Data warehousing lecture 10
Intro to Data warehousing   lecture 10Intro to Data warehousing   lecture 10
Intro to Data warehousing lecture 10
AnwarrChaudary
ย 
Intro to Data warehousing lecture 09
Intro to Data warehousing   lecture 09Intro to Data warehousing   lecture 09
Intro to Data warehousing lecture 09
AnwarrChaudary
ย 
Intro to Data warehousing lecture 08
Intro to Data warehousing   lecture 08Intro to Data warehousing   lecture 08
Intro to Data warehousing lecture 08
AnwarrChaudary
ย 
Intro to Data warehousing lecture 07
Intro to Data warehousing   lecture 07Intro to Data warehousing   lecture 07
Intro to Data warehousing lecture 07
AnwarrChaudary
ย 
Intro to Data warehousing Lecture 06
Intro to Data warehousing   Lecture 06Intro to Data warehousing   Lecture 06
Intro to Data warehousing Lecture 06
AnwarrChaudary
ย 
Intro to Data warehousing lecture 05
Intro to Data warehousing   lecture 05Intro to Data warehousing   lecture 05
Intro to Data warehousing lecture 05
AnwarrChaudary
ย 
Intro to Data warehousing Lecture 04
Intro to Data warehousing   Lecture 04Intro to Data warehousing   Lecture 04
Intro to Data warehousing Lecture 04
AnwarrChaudary
ย 
Intro to Data warehousing lecture 02
Intro to Data warehousing   lecture 02Intro to Data warehousing   lecture 02
Intro to Data warehousing lecture 02
AnwarrChaudary
ย 
Introduction to Data Warehouse
Introduction to Data WarehouseIntroduction to Data Warehouse
Introduction to Data Warehouse
AnwarrChaudary
ย 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
AnwarrChaudary
ย 

More from AnwarrChaudary (20)

Intro to Data warehousing lecture 20
Intro to Data warehousing   lecture 20Intro to Data warehousing   lecture 20
Intro to Data warehousing lecture 20
ย 
Intro to Data warehousing lecture 19
Intro to Data warehousing   lecture 19Intro to Data warehousing   lecture 19
Intro to Data warehousing lecture 19
ย 
Intro to Data warehousing lecture 18
Intro to Data warehousing   lecture 18Intro to Data warehousing   lecture 18
Intro to Data warehousing lecture 18
ย 
Intro to Data warehousing lecture 17
Intro to Data warehousing   lecture 17Intro to Data warehousing   lecture 17
Intro to Data warehousing lecture 17
ย 
Intro to Data warehousing lecture 16
Intro to Data warehousing   lecture 16Intro to Data warehousing   lecture 16
Intro to Data warehousing lecture 16
ย 
Intro to Data warehousing lecture 15
Intro to Data warehousing   lecture 15Intro to Data warehousing   lecture 15
Intro to Data warehousing lecture 15
ย 
Intro to Data warehousing lecture 14
Intro to Data warehousing   lecture 14Intro to Data warehousing   lecture 14
Intro to Data warehousing lecture 14
ย 
Intro to Data warehousing lecture 13
Intro to Data warehousing   lecture 13Intro to Data warehousing   lecture 13
Intro to Data warehousing lecture 13
ย 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
ย 
Intro to Data warehousing lecture 11
Intro to Data warehousing   lecture 11Intro to Data warehousing   lecture 11
Intro to Data warehousing lecture 11
ย 
Intro to Data warehousing lecture 10
Intro to Data warehousing   lecture 10Intro to Data warehousing   lecture 10
Intro to Data warehousing lecture 10
ย 
Intro to Data warehousing lecture 09
Intro to Data warehousing   lecture 09Intro to Data warehousing   lecture 09
Intro to Data warehousing lecture 09
ย 
Intro to Data warehousing lecture 08
Intro to Data warehousing   lecture 08Intro to Data warehousing   lecture 08
Intro to Data warehousing lecture 08
ย 
Intro to Data warehousing lecture 07
Intro to Data warehousing   lecture 07Intro to Data warehousing   lecture 07
Intro to Data warehousing lecture 07
ย 
Intro to Data warehousing Lecture 06
Intro to Data warehousing   Lecture 06Intro to Data warehousing   Lecture 06
Intro to Data warehousing Lecture 06
ย 
Intro to Data warehousing lecture 05
Intro to Data warehousing   lecture 05Intro to Data warehousing   lecture 05
Intro to Data warehousing lecture 05
ย 
Intro to Data warehousing Lecture 04
Intro to Data warehousing   Lecture 04Intro to Data warehousing   Lecture 04
Intro to Data warehousing Lecture 04
ย 
Intro to Data warehousing lecture 02
Intro to Data warehousing   lecture 02Intro to Data warehousing   lecture 02
Intro to Data warehousing lecture 02
ย 
Introduction to Data Warehouse
Introduction to Data WarehouseIntroduction to Data Warehouse
Introduction to Data Warehouse
ย 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
ย 

Recently uploaded

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
MJDuyan
ย 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
National Information Standards Organization (NISO)
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
National Information Standards Organization (NISO)
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Henry Hollis
ย 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
zuzanka
ย 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
melliereed
ย 
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Nguyen Thanh Tu Collection
ย 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
zuzanka
ย 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
PsychoTech Services
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
ย 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
ย 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
RAHUL
ย 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
ย 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
TechSoup
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
RidwanHassanYusuf
ย 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
ย 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
RamseyBerglund
ย 

Recently uploaded (20)

Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) CurriculumPhilippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
Philippine Edukasyong Pantahanan at Pangkabuhayan (EPP) Curriculum
ย 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
ย 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
ย 
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
Jemison, MacLaughlin, and Majumder "Broadening Pathways for Editors and Authors"
ย 
Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"Benner "Expanding Pathways to Publishing Careers"
Benner "Expanding Pathways to Publishing Careers"
ย 
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.pptLevel 3 NCEA - NZ: A  Nation In the Making 1872 - 1900 SML.ppt
Level 3 NCEA - NZ: A Nation In the Making 1872 - 1900 SML.ppt
ย 
SWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptxSWOT analysis in the project Keeping the Memory @live.pptx
SWOT analysis in the project Keeping the Memory @live.pptx
ย 
Nutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour TrainingNutrition Inc FY 2024, 4 - Hour Training
Nutrition Inc FY 2024, 4 - Hour Training
ย 
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
Bร€I TแบฌP Dแบ Y THรŠM TIแบพNG ANH LแปšP 7 Cแบข Nฤ‚M FRIENDS PLUS SรCH CHร‚N TRแปœI SรNG Tแบ O ...
ย 
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptxRESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
RESULTS OF THE EVALUATION QUESTIONNAIRE.pptx
ย 
Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...Gender and Mental Health - Counselling and Family Therapy Applications and In...
Gender and Mental Health - Counselling and Family Therapy Applications and In...
ย 
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Prรฉsentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
ย 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
ย 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
ย 
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UPLAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
LAND USE LAND COVER AND NDVI OF MIRZAPUR DISTRICT, UP
ย 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
ย 
Walmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdfWalmart Business+ and Spark Good for Nonprofits.pdf
Walmart Business+ and Spark Good for Nonprofits.pdf
ย 
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptxBIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
BIOLOGY NATIONAL EXAMINATION COUNCIL (NECO) 2024 PRACTICAL MANUAL.pptx
ย 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
ย 
Electric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger HuntElectric Fetus - Record Store Scavenger Hunt
Electric Fetus - Record Store Scavenger Hunt
ย 

Intro to Data warehousing lecture 03

  • 1. Intro to Data Warehousing Normalization - 1 Ch Anwar ul Hassan (Lecturer) Department of Computer Science and Software Engineering Capital University of Sciences & Technology, Islamabad Pakistan anwarchaudary@gmail.com
  • 2. ๏‚ง A step by step process to produce more efficient and accurate database design ๏‚ง Purpose is to produce an anomaly free design What is Normalization
  • 3. ๏‚ง An inconsistent, incomplete or incorrect state of database ๏‚ง Four types of anomalies are of concern here; ๏‚ง Redundancy ๏‚ง Insertion ๏‚ง Deletion ๏‚ง Updation Anomalies
  • 5. - 5 Normalization What are the goals of normalization? ๏‚ง Eliminate redundant data. ๏‚ง Ensure data dependencies make sense. What is the result of normalization? ๏‚ง Normalized design makes the maintenance of database easier
  • 6. ๏‚ง Different forms or levels of normalization ๏‚ง Called first, second, third and so on forms ๏‚ง Each form has got certain conditions ๏‚ง If a table fulfils the condition(s) for a normal form then the table is in that normal form What are the levels of normalization?
  • 7. ๏‚ง A relation is in first normal form iff every attribute in every tuple contains an atomic value ๏‚ง There is no multivalued (repeating group) in the relation ๏‚ง A column should contain the value of same type ๏‚ง Each column should have unique name ๏‚ง Order in which data is saved doesnโ€™t matter Normalization: 1NF
  • 9. โ€ข Value of same type โ€ข unique column name โ€ข Data store order Normalization: 1NF
  • 10. - 10 Normalization SID: Student ID Degree: Registered as BS or MS student Campus: City where campus is located Course: Course taken Marks: Score out of max of 50 Consider a student database system to be developed for a multi-campus university, such that it specializes in one degree program at a campus i.e. BS, MS or PhD. SID Degree Campus Course Marks 1 BS Islamabad CS-101 30 1 BS Islamabad CS-102 20 1 BS Islamabad CS-103 40 1 BS Islamabad CS-104 20 1 BS Islamabad CS-105 10 1 BS Islamabad CS-106 10 2 MS Lahore CS-101 30 2 MS Lahore CS-102 40 3 MS Lahore CS-102 20 4 BS Islamabad CS-102 20 4 BS Islamabad CS-104 30 4 BS Islamabad CS-105 40
  • 11. - 11 Normalization: 1NF Only contains atomic values, BUT also contains redundant data. 40CS-105IslamabadBS4 30CS-104IslamabadBS4 20CS-102IslamabadBS4 20CS-102LahoreMS3 40CS-102LahoreMS2 30CS-101LahoreMS2 10CS-106IslamabadBS1 10CS-105IslamabadBS1 20CS-104IslamabadBS1 40CS-103IslamabadBS1 20CS-102IslamabadBS1 30CS-101IslamabadBS1 MarksCourseCampusDegreeSID FIRST
  • 12. - 12 Normalization: 1NF Update anomalies INSERT. Certain student with SID 5 got admission in a different campus (say) Karachi cannot be added until the student registers for a course. DELETE. If student graduates and his/her corresponding record is deleted, then all information about that student is lost. UPDATE. If student migrates from Islamabad campus to Lahore campus (say) SID = 1, then six rows would have to be updated with this new information.
  • 13. ๏‚ง A relation is in 2nd normal form iff it is in the first normal form and all non key attributes are fully functionally dependent on key, that is, there is no partial dependency Normalization: 2NF
  • 14. - 14 Normalization: 2NF Every non-key column is fully dependent on the PK FIRST is in 1NF but not in 2NF because degree and campus are functionally dependent upon only on the column SID of the composite key (SID, course). This can be illustrated by listing the functional dependencies in the table: SID โ€”> campus, degree campus โ€”> degree (SID, Course) โ€”> Marks To transform the table FIRST into 2NF we move the columns SID, Degree and Campus to a new table called REGISTRATION. The column SID becomes the primary key of this new table. SID & Campus are NOT unique
  • 15. - 15 Normalization SID: Student ID Degree: Registered as BS or MS student Campus: City where campus is located Course: Course taken Marks: Score out of max of 50 SID Degree Campus Course Marks 1 BS Islamabad CS-101 30 1 BS Islamabad CS-102 20 1 BS Islamabad CS-103 40 1 BS Islamabad CS-104 20 1 BS Islamabad CS-105 10 1 BS Islamabad CS-106 10 2 MS Lahore CS-101 30 2 MS Lahore CS-102 40 3 MS Lahore CS-102 20 4 BS Islamabad CS-102 20 4 BS Islamabad CS-104 30 4 BS Islamabad CS-105 40
  • 16. - 16 Normalization: 2NF SID Degree Campus 1 BS Islamabad 2 MS Lahore 3 MS Lahore 4 BS Islamabad 5 PhD Peshawar SID Course Marks 1 CS-101 30 1 CS-102 20 1 CS-103 40 1 CS-104 20 1 CS-105 10 1 CS-106 10 2 CS-101 30 2 CS-102 40 3 CS-102 20 4 CS-102 20 4 CS-104 30 4 CS-105 40 REGISTRATION PERFORMANCE SID is now a PK PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
  • 17. - 17 Normalization: 2NF Presence of modification anomalies for tables in 2NF. For the table REGISTRATION, they are: ๏‚ง INSERT: Until a student gets registered in a degree program, that program cannot be offered! ๏‚ง DELETE: Deleting any row from REGISTRATION destroys all other facts in the table.
  • 18. - 18 Normalization SID Degree Campus 1 BS Islamabad 2 MS Lahore 3 MS Lahore 4 BS Islamabad 5 PhD Peshawar SID Course Marks 1 CS-101 30 1 CS-102 20 1 CS-103 40 1 CS-104 20 1 CS-105 10 1 CS-106 10 2 CS-101 30 2 CS-102 40 3 CS-102 20 4 CS-102 20 4 CS-104 30 4 CS-105 40 REGISTRATION PERFORMANCE SID is now a PK PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
  • 19. - 19 Normalization: 3NF All columns must be dependent only on the primary key. Table PERFORMANCE is already in 3NF. The non-key column, marks, is fully dependent upon the primary key (SID, degree). REGISTRATION is in 2NF but not in 3NF because it contains a transitive dependency. A transitive dependency occurs when a non-key attribute is dependent on another non-key attribute The concept of a transitive dependency can be illustrated by showing the functional dependencies in REGISTRATION: REGISTRATION.SID โ€”> REGISTRATION.Degree REGISTRATION.SID โ€”> REGISTRATION.Campus REGISTRATION.Campus โ€”> REGISTRATION.Degree Note that REGISTRATION.Degree is determined both by the primary key SID and the non-key column campus.
  • 20. - 20 Normalization: 3NF To transform REGISTRATION into 3NF, we create a new table called CAMPUS_DEGREE and move the columns campus and degree into it. Degree is deleted from the original table, campus is left behind to serve as a foreign key to CAMPUS_DEGREE, and the original table is renamed to STUDENT_CAMPUS to reflect its semantic meaning.
  • 22. - 22 Normalization: 3NF Removal of anomalies and improvement in queries as follows: ๏‚ง INSERT: Able to first offer a degree program, and then students registering in it. ๏‚ง UPDATE: Migrating students between campuses by changing a single row. ๏‚ง DELETE: Deleting information about a course, without deleting facts about all columns in the record.
  • 23. - 23 Normalization Conclusions: ๏‚ง Normalization guidelines are cumulative. ๏‚ง Generally a good idea to only ensure 2NF. ๏‚ง 3NF is at the cost of simplicity and performance. ๏‚ง BCNF (3.5NF) ๏‚ง There is a 4NF with no multi-valued dependencies. ๏‚ง There is also a 5NF.