SlideShare a Scribd company logo
1 of 15
LECTURE # 6
Normalization
1
Data Warehousing
Normalization
2
Normalization is the process of efficiently
organizing data in a database by decomposing
(splitting) a relational table into smaller tables.
Normalization
3
What are the goals of normalization?
 Eliminate redundant data. (for example, storing the same data in
more than one table)
 Ensure data dependencies make sense (only storing
related data in a table)
Normalization
4
What is the result of normalization?
What are the levels of normalization?
Normalization
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
5
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.
Normalization: 1NF
6
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
Normalization: 1NF
7
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.
Normalization: 2NF
8
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.
Normalization: 2NF
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
SID Degree Campus
1 BS Islamabad
2 MS Lahore
3 MS Lahore
4 BS Islamabad
5 PhD Peshawar
9
REGISTRATION
PERFORMANCE
SID is now a PK
PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
Normalization: 2NF
10
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.
Why there are anomalies?
The table is in 2NF but NOT in 3NF
Normalization: 3NF
11
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, course).
REGISTRATION is in 2NF but not in 3NF because it contains a transitive
dependency.
A transitive dependency occurs when a non-key column that is a
determinant of the primary key is the determinate of other columns.
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.
Normalization: 3NF
12
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.
Normalization: 3NF
13
PeshawarPhD5
IslamabadBS4
LahoreMS3
LahoreMS2
IslamabadBS1
CampusDegreeSID
REGISTRATION
Peshawar5
Islamabad4
Lahore3
Lahore2
Islamabad1
CampusSID
STUDENT_CAMPUS
PhDPeshawar
MSLahore
BSIslamabad
DegreeCampus
CAMPUS_DEGREE
Normalization: 3NF
14
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.
Normalization
15
Conclusions:
 Normalization guidelines are cumulative.
 Generally a good idea to only ensure 2NF.
 3NF is at the cost of simplicity and performance.
 There is a 4NF with no multi-valued
dependencies.
 There is also a 5NF.

More Related Content

What's hot

Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basicsnitin anjankar
 
Database Administration
Database AdministrationDatabase Administration
Database AdministrationBilal Arshad
 
Buffer management --database buffering
Buffer management --database buffering Buffer management --database buffering
Buffer management --database buffering julia121214
 
Types and Functions of DDBMS
Types and Functions of DDBMSTypes and Functions of DDBMS
Types and Functions of DDBMSAdeel Rasheed
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptxAnkit Rai
 
Building an Effective Data Warehouse Architecture
Building an Effective Data Warehouse ArchitectureBuilding an Effective Data Warehouse Architecture
Building an Effective Data Warehouse ArchitectureJames Serra
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Query optimization in SQL
Query optimization in SQLQuery optimization in SQL
Query optimization in SQLAbdul Rehman
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academythewebsacademy
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and modelssabah N
 
Why shift from ETL to ELT?
Why shift from ETL to ELT?Why shift from ETL to ELT?
Why shift from ETL to ELT?HEXANIKA
 
What’s New in Oracle Database 19c - Part 1
What’s New in Oracle Database 19c - Part 1What’s New in Oracle Database 19c - Part 1
What’s New in Oracle Database 19c - Part 1Satishbabu Gunukula
 
Présentation Oracle DataBase 11g
Présentation Oracle DataBase 11gPrésentation Oracle DataBase 11g
Présentation Oracle DataBase 11gCynapsys It Hotspot
 
Less14 br concepts
Less14 br conceptsLess14 br concepts
Less14 br conceptsAmit Bhalla
 
Introduction To Data Warehousing
Introduction To Data WarehousingIntroduction To Data Warehousing
Introduction To Data WarehousingAlex Meadows
 

What's hot (20)

Oracle Database Performance Tuning Basics
Oracle Database Performance Tuning BasicsOracle Database Performance Tuning Basics
Oracle Database Performance Tuning Basics
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Database Administration
Database AdministrationDatabase Administration
Database Administration
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
 
Buffer management --database buffering
Buffer management --database buffering Buffer management --database buffering
Buffer management --database buffering
 
Types and Functions of DDBMS
Types and Functions of DDBMSTypes and Functions of DDBMS
Types and Functions of DDBMS
 
SQL Joins.pptx
SQL Joins.pptxSQL Joins.pptx
SQL Joins.pptx
 
Building an Effective Data Warehouse Architecture
Building an Effective Data Warehouse ArchitectureBuilding an Effective Data Warehouse Architecture
Building an Effective Data Warehouse Architecture
 
Relational Database Management System
Relational Database Management SystemRelational Database Management System
Relational Database Management System
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Query optimization in SQL
Query optimization in SQLQuery optimization in SQL
Query optimization in SQL
 
MySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs AcademyMySql Triggers Tutorial - The Webs Academy
MySql Triggers Tutorial - The Webs Academy
 
data modeling and models
data modeling and modelsdata modeling and models
data modeling and models
 
Advanced sql
Advanced sqlAdvanced sql
Advanced sql
 
Why shift from ETL to ELT?
Why shift from ETL to ELT?Why shift from ETL to ELT?
Why shift from ETL to ELT?
 
What’s New in Oracle Database 19c - Part 1
What’s New in Oracle Database 19c - Part 1What’s New in Oracle Database 19c - Part 1
What’s New in Oracle Database 19c - Part 1
 
Présentation Oracle DataBase 11g
Présentation Oracle DataBase 11gPrésentation Oracle DataBase 11g
Présentation Oracle DataBase 11g
 
Less14 br concepts
Less14 br conceptsLess14 br concepts
Less14 br concepts
 
Introduction To Data Warehousing
Introduction To Data WarehousingIntroduction To Data Warehousing
Introduction To Data Warehousing
 
Data Flow Diagram
Data Flow DiagramData Flow Diagram
Data Flow Diagram
 

Similar to Dwh lecture-06-normalization

Intro to Data warehousing lecture 03
Intro to Data warehousing   lecture 03Intro to Data warehousing   lecture 03
Intro to Data warehousing lecture 03AnwarrChaudary
 
PP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptxPP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptxskilljiolms
 
Normalization.pptx
Normalization.pptxNormalization.pptx
Normalization.pptxSreenivas R
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.pptDeependra35
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL FundamentalsBrian Foote
 
Impact of Normalization in Future
Impact of Normalization in FutureImpact of Normalization in Future
Impact of Normalization in Futureijtsrd
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptxkshipra sony
 
Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.Alexey Furmanov
 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for BeginnersProduct School
 
Presentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptxPresentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptxssuser046cf5
 
Dependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its typesDependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its typesnsrChowdary1
 
Normalization
NormalizationNormalization
NormalizationRamesh 4
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxBhupendraShahi6
 

Similar to Dwh lecture-06-normalization (20)

Lecture 6
Lecture 6Lecture 6
Lecture 6
 
Intro to Data warehousing lecture 03
Intro to Data warehousing   lecture 03Intro to Data warehousing   lecture 03
Intro to Data warehousing lecture 03
 
PP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptxPP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptx
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
 
Normalization.pptx
Normalization.pptxNormalization.pptx
Normalization.pptx
 
Dbms record
Dbms recordDbms record
Dbms record
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
 
Sppt chap007
Sppt chap007Sppt chap007
Sppt chap007
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
 
Impact of Normalization in Future
Impact of Normalization in FutureImpact of Normalization in Future
Impact of Normalization in Future
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.Lecture 3. MS SQL. Cursors.
Lecture 3. MS SQL. Cursors.
 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for Beginners
 
Presentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptxPresentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptx
 
Dependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its typesDependencies in various topics like normalisation and its types
Dependencies in various topics like normalisation and its types
 
Normalization
NormalizationNormalization
Normalization
 
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptxSQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
SQL-Tutorial.P1241112567Pczwq.powerpoint.pptx
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 

More from Sulman Ahmed

Entrepreneurial Strategy Generating and Exploiting new entries
Entrepreneurial Strategy Generating and Exploiting new entriesEntrepreneurial Strategy Generating and Exploiting new entries
Entrepreneurial Strategy Generating and Exploiting new entriesSulman Ahmed
 
Entrepreneurial Intentions and corporate entrepreneurship
Entrepreneurial Intentions and corporate entrepreneurshipEntrepreneurial Intentions and corporate entrepreneurship
Entrepreneurial Intentions and corporate entrepreneurshipSulman Ahmed
 
Entrepreneurship main concepts and description
Entrepreneurship main concepts and descriptionEntrepreneurship main concepts and description
Entrepreneurship main concepts and descriptionSulman Ahmed
 
Run time Verification using formal methods
Run time Verification using formal methodsRun time Verification using formal methods
Run time Verification using formal methodsSulman Ahmed
 
Use of Formal Methods at Amazon Web Services
Use of Formal Methods at Amazon Web ServicesUse of Formal Methods at Amazon Web Services
Use of Formal Methods at Amazon Web ServicesSulman Ahmed
 
student learning App
student learning Appstudent learning App
student learning AppSulman Ahmed
 
Software Engineering Economics Life Cycle.
Software Engineering Economics  Life Cycle.Software Engineering Economics  Life Cycle.
Software Engineering Economics Life Cycle.Sulman Ahmed
 
Data mining Techniques
Data mining TechniquesData mining Techniques
Data mining TechniquesSulman Ahmed
 
Rules of data mining
Rules of data miningRules of data mining
Rules of data miningSulman Ahmed
 
Rules of data mining
Rules of data miningRules of data mining
Rules of data miningSulman Ahmed
 
Classification in data mining
Classification in data mining Classification in data mining
Classification in data mining Sulman Ahmed
 
Data mining Basics and complete description
Data mining Basics and complete description Data mining Basics and complete description
Data mining Basics and complete description Sulman Ahmed
 
Data mining Basics and complete description onword
Data mining Basics and complete description onwordData mining Basics and complete description onword
Data mining Basics and complete description onwordSulman Ahmed
 
Dwh lecture 13-process dm
Dwh  lecture 13-process dmDwh  lecture 13-process dm
Dwh lecture 13-process dmSulman Ahmed
 
Dwh lecture 11-molap
Dwh  lecture 11-molapDwh  lecture 11-molap
Dwh lecture 11-molapSulman Ahmed
 
Dwh lecture 10-olap
Dwh   lecture 10-olapDwh   lecture 10-olap
Dwh lecture 10-olapSulman Ahmed
 
Dwh lecture 08-denormalization tech
Dwh   lecture 08-denormalization techDwh   lecture 08-denormalization tech
Dwh lecture 08-denormalization techSulman Ahmed
 
Dwh lecture 07-denormalization
Dwh   lecture 07-denormalizationDwh   lecture 07-denormalization
Dwh lecture 07-denormalizationSulman Ahmed
 

More from Sulman Ahmed (20)

Entrepreneurial Strategy Generating and Exploiting new entries
Entrepreneurial Strategy Generating and Exploiting new entriesEntrepreneurial Strategy Generating and Exploiting new entries
Entrepreneurial Strategy Generating and Exploiting new entries
 
Entrepreneurial Intentions and corporate entrepreneurship
Entrepreneurial Intentions and corporate entrepreneurshipEntrepreneurial Intentions and corporate entrepreneurship
Entrepreneurial Intentions and corporate entrepreneurship
 
Entrepreneurship main concepts and description
Entrepreneurship main concepts and descriptionEntrepreneurship main concepts and description
Entrepreneurship main concepts and description
 
Run time Verification using formal methods
Run time Verification using formal methodsRun time Verification using formal methods
Run time Verification using formal methods
 
Use of Formal Methods at Amazon Web Services
Use of Formal Methods at Amazon Web ServicesUse of Formal Methods at Amazon Web Services
Use of Formal Methods at Amazon Web Services
 
student learning App
student learning Appstudent learning App
student learning App
 
Software Engineering Economics Life Cycle.
Software Engineering Economics  Life Cycle.Software Engineering Economics  Life Cycle.
Software Engineering Economics Life Cycle.
 
Data mining Techniques
Data mining TechniquesData mining Techniques
Data mining Techniques
 
Rules of data mining
Rules of data miningRules of data mining
Rules of data mining
 
Rules of data mining
Rules of data miningRules of data mining
Rules of data mining
 
Classification in data mining
Classification in data mining Classification in data mining
Classification in data mining
 
Data mining Basics and complete description
Data mining Basics and complete description Data mining Basics and complete description
Data mining Basics and complete description
 
Data mining Basics and complete description onword
Data mining Basics and complete description onwordData mining Basics and complete description onword
Data mining Basics and complete description onword
 
Dwh lecture 12-dm
Dwh lecture 12-dmDwh lecture 12-dm
Dwh lecture 12-dm
 
Dwh lecture 13-process dm
Dwh  lecture 13-process dmDwh  lecture 13-process dm
Dwh lecture 13-process dm
 
Dwh lecture 11-molap
Dwh  lecture 11-molapDwh  lecture 11-molap
Dwh lecture 11-molap
 
Dwh lecture 10-olap
Dwh   lecture 10-olapDwh   lecture 10-olap
Dwh lecture 10-olap
 
Dwh lecture 08-denormalization tech
Dwh   lecture 08-denormalization techDwh   lecture 08-denormalization tech
Dwh lecture 08-denormalization tech
 
Dwh lecture 07-denormalization
Dwh   lecture 07-denormalizationDwh   lecture 07-denormalization
Dwh lecture 07-denormalization
 
Wbs
WbsWbs
Wbs
 

Recently uploaded

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 

Recently uploaded (20)

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 

Dwh lecture-06-normalization

  • 2. Normalization 2 Normalization is the process of efficiently organizing data in a database by decomposing (splitting) a relational table into smaller tables.
  • 3. Normalization 3 What are the goals of normalization?  Eliminate redundant data. (for example, storing the same data in more than one table)  Ensure data dependencies make sense (only storing related data in a table)
  • 4. Normalization 4 What is the result of normalization? What are the levels of normalization?
  • 5. Normalization 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 5 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.
  • 6. Normalization: 1NF 6 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
  • 7. Normalization: 1NF 7 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.
  • 8. Normalization: 2NF 8 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.
  • 9. Normalization: 2NF 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 SID Degree Campus 1 BS Islamabad 2 MS Lahore 3 MS Lahore 4 BS Islamabad 5 PhD Peshawar 9 REGISTRATION PERFORMANCE SID is now a PK PERFORMANCE in 2NF as (SID, Course) uniquely identify Marks
  • 10. Normalization: 2NF 10 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. Why there are anomalies? The table is in 2NF but NOT in 3NF
  • 11. Normalization: 3NF 11 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, course). REGISTRATION is in 2NF but not in 3NF because it contains a transitive dependency. A transitive dependency occurs when a non-key column that is a determinant of the primary key is the determinate of other columns. 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.
  • 12. Normalization: 3NF 12 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.
  • 14. Normalization: 3NF 14 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.
  • 15. Normalization 15 Conclusions:  Normalization guidelines are cumulative.  Generally a good idea to only ensure 2NF.  3NF is at the cost of simplicity and performance.  There is a 4NF with no multi-valued dependencies.  There is also a 5NF.

Editor's Notes

  1. Logical grouping of data
  2. Why redundancy removed: bcz need performance so if u require update on multiple places so it takes time. Arrange dependencies Both of these are worthy goals, as they reduce the amount of space a database consumes, and ensure that data is logically stored and is in third normal form (3NF).
  3. Normal forms have accumulative effect. Normalization improves aesthetics
  4. no two Rows of data must contain repeating group of information
  5. Select campus, degree from student where sid=5 Select marks where sid=5, that’s why need courseid also. Both form composite key. A Functional dependency is a relationship between attributes. For example, if we know the value of sid, we can obtain campus, degree etc. By this, we say that campus and degree is functionally dependent on sid.