SlideShare a Scribd company logo
1 of 14
Ahsan AbdullahAhsan Abdullah
11
Data WarehousingData Warehousing
Lecture-6Lecture-6
NormalizationNormalization
Virtual University of PakistanVirtual University of Pakistan
Ahsan Abdullah
Assoc. Prof. & Head
Center for Agro-Informatics Research
www.nu.edu.pk/cairindex.asp
National University of Computers & Emerging Sciences, Islamabad
Email: ahsan@cluxing.com
Ahsan Abdullah
2
NormalizationNormalization
Ahsan Abdullah
3
NormalizationNormalization
What is normalization?
What are the goals of normalization?
 Eliminate redundant data.
 Ensure data dependencies make sense.
What is the result of normalization?
What are the levels of normalization?
Always follow purists approach of normalization?
NONO
Ahsan Abdullah
4
NormalizationNormalization
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
Ahsan Abdullah
5
Normalization: 1NFNormalization: 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
Ahsan Abdullah
6
Normalization: 1NFNormalization: 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.
Ahsan Abdullah
7
Normalization: 2NFNormalization: 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
Ahsan Abdullah
8
Normalization: 2NFNormalization: 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
Ahsan Abdullah
9
Normalization: 2NFNormalization: 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.
Why there are anomalies?
The table is in 2NF but NOT in 3NF
Ahsan Abdullah
10
Normalization: 3NFNormalization: 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 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.
Ahsan Abdullah
11
Normalization: 3NFNormalization: 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.
Ahsan Abdullah
12
Normalization: 3NFNormalization: 3NF
PeshawarPhD5
IslamabadBS4
LahoreMS3
LahoreMS2
IslamabadBS1
CampusDegreeSID
REGISTRATION
Peshawar5
Islamabad4
Lahore3
Lahore2
Islamabad1
CampusSID
STUDENT_CAMPUS
PhDPeshawar
MSLahore
BSIslamabad
DegreeCampus
CAMPUS_DEGREE
Ahsan Abdullah
13
Normalization: 3NFNormalization: 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.
Ahsan Abdullah
14
NormalizationNormalization
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

Similar to Lecture 6

Similar to Lecture 6 (19)

PP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptxPP DBMS - 2 (1) (1).pptx
PP DBMS - 2 (1) (1).pptx
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
Dbms record
Dbms recordDbms record
Dbms record
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
Impact of Normalization in Future
Impact of Normalization in FutureImpact of Normalization in Future
Impact of Normalization in Future
 
Normalization.pptx
Normalization.pptxNormalization.pptx
Normalization.pptx
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
 
Presentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptxPresentations_PPT_Unit-2_25042019031227AM.pptx
Presentations_PPT_Unit-2_25042019031227AM.pptx
 
D I T211 Chapter 6
D I T211    Chapter 6D I T211    Chapter 6
D I T211 Chapter 6
 
Normalization
NormalizationNormalization
Normalization
 
Sppt chap007
Sppt chap007Sppt chap007
Sppt chap007
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
 
Linked lists
Linked listsLinked lists
Linked lists
 
Data Manipulation Language
Data Manipulation LanguageData Manipulation Language
Data Manipulation Language
 
SQL Fundamentals
SQL FundamentalsSQL Fundamentals
SQL Fundamentals
 
uniT 4 (1).pptx
uniT 4 (1).pptxuniT 4 (1).pptx
uniT 4 (1).pptx
 
Intro to SQL for Beginners
Intro to SQL for BeginnersIntro to SQL for Beginners
Intro to SQL for Beginners
 
4 the sql_standard
4 the  sql_standard4 the  sql_standard
4 the sql_standard
 

More from Shani729

Python tutorialfeb152012
Python tutorialfeb152012Python tutorialfeb152012
Python tutorialfeb152012Shani729
 
Python tutorial
Python tutorialPython tutorial
Python tutorialShani729
 
Interaction design _beyond_human_computer_interaction
Interaction design _beyond_human_computer_interactionInteraction design _beyond_human_computer_interaction
Interaction design _beyond_human_computer_interactionShani729
 
Fm lecturer 13(final)
Fm lecturer 13(final)Fm lecturer 13(final)
Fm lecturer 13(final)Shani729
 
Lecture slides week14-15
Lecture slides week14-15Lecture slides week14-15
Lecture slides week14-15Shani729
 
Frequent itemset mining using pattern growth method
Frequent itemset mining using pattern growth methodFrequent itemset mining using pattern growth method
Frequent itemset mining using pattern growth methodShani729
 
Dwh lecture slides-week15
Dwh lecture slides-week15Dwh lecture slides-week15
Dwh lecture slides-week15Shani729
 
Dwh lecture slides-week10
Dwh lecture slides-week10Dwh lecture slides-week10
Dwh lecture slides-week10Shani729
 
Dwh lecture slidesweek7&8
Dwh lecture slidesweek7&8Dwh lecture slidesweek7&8
Dwh lecture slidesweek7&8Shani729
 
Dwh lecture slides-week5&6
Dwh lecture slides-week5&6Dwh lecture slides-week5&6
Dwh lecture slides-week5&6Shani729
 
Dwh lecture slides-week1
Dwh lecture slides-week1Dwh lecture slides-week1
Dwh lecture slides-week1Shani729
 
Dwh lecture slides-week 13
Dwh lecture slides-week 13Dwh lecture slides-week 13
Dwh lecture slides-week 13Shani729
 
Dwh lecture slides-week 12&13
Dwh lecture slides-week 12&13Dwh lecture slides-week 12&13
Dwh lecture slides-week 12&13Shani729
 
Data warehousing and mining furc
Data warehousing and mining furcData warehousing and mining furc
Data warehousing and mining furcShani729
 
Lecture 40
Lecture 40Lecture 40
Lecture 40Shani729
 
Lecture 39
Lecture 39Lecture 39
Lecture 39Shani729
 
Lecture 38
Lecture 38Lecture 38
Lecture 38Shani729
 
Lecture 37
Lecture 37Lecture 37
Lecture 37Shani729
 
Lecture 35
Lecture 35Lecture 35
Lecture 35Shani729
 
Lecture 36
Lecture 36Lecture 36
Lecture 36Shani729
 

More from Shani729 (20)

Python tutorialfeb152012
Python tutorialfeb152012Python tutorialfeb152012
Python tutorialfeb152012
 
Python tutorial
Python tutorialPython tutorial
Python tutorial
 
Interaction design _beyond_human_computer_interaction
Interaction design _beyond_human_computer_interactionInteraction design _beyond_human_computer_interaction
Interaction design _beyond_human_computer_interaction
 
Fm lecturer 13(final)
Fm lecturer 13(final)Fm lecturer 13(final)
Fm lecturer 13(final)
 
Lecture slides week14-15
Lecture slides week14-15Lecture slides week14-15
Lecture slides week14-15
 
Frequent itemset mining using pattern growth method
Frequent itemset mining using pattern growth methodFrequent itemset mining using pattern growth method
Frequent itemset mining using pattern growth method
 
Dwh lecture slides-week15
Dwh lecture slides-week15Dwh lecture slides-week15
Dwh lecture slides-week15
 
Dwh lecture slides-week10
Dwh lecture slides-week10Dwh lecture slides-week10
Dwh lecture slides-week10
 
Dwh lecture slidesweek7&8
Dwh lecture slidesweek7&8Dwh lecture slidesweek7&8
Dwh lecture slidesweek7&8
 
Dwh lecture slides-week5&6
Dwh lecture slides-week5&6Dwh lecture slides-week5&6
Dwh lecture slides-week5&6
 
Dwh lecture slides-week1
Dwh lecture slides-week1Dwh lecture slides-week1
Dwh lecture slides-week1
 
Dwh lecture slides-week 13
Dwh lecture slides-week 13Dwh lecture slides-week 13
Dwh lecture slides-week 13
 
Dwh lecture slides-week 12&13
Dwh lecture slides-week 12&13Dwh lecture slides-week 12&13
Dwh lecture slides-week 12&13
 
Data warehousing and mining furc
Data warehousing and mining furcData warehousing and mining furc
Data warehousing and mining furc
 
Lecture 40
Lecture 40Lecture 40
Lecture 40
 
Lecture 39
Lecture 39Lecture 39
Lecture 39
 
Lecture 38
Lecture 38Lecture 38
Lecture 38
 
Lecture 37
Lecture 37Lecture 37
Lecture 37
 
Lecture 35
Lecture 35Lecture 35
Lecture 35
 
Lecture 36
Lecture 36Lecture 36
Lecture 36
 

Recently uploaded

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxvipinkmenon1
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girlsssuser7cb4ff
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLDeelipZope
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxk795866
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 

Recently uploaded (20)

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Introduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptxIntroduction to Microprocesso programming and interfacing.pptx
Introduction to Microprocesso programming and interfacing.pptx
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Call Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call GirlsCall Girls Narol 7397865700 Independent Call Girls
Call Girls Narol 7397865700 Independent Call Girls
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Current Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCLCurrent Transformer Drawing and GTP for MSETCL
Current Transformer Drawing and GTP for MSETCL
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Introduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptxIntroduction-To-Agricultural-Surveillance-Rover.pptx
Introduction-To-Agricultural-Surveillance-Rover.pptx
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 

Lecture 6

  • 1. Ahsan AbdullahAhsan Abdullah 11 Data WarehousingData Warehousing Lecture-6Lecture-6 NormalizationNormalization Virtual University of PakistanVirtual University of Pakistan Ahsan Abdullah Assoc. Prof. & Head Center for Agro-Informatics Research www.nu.edu.pk/cairindex.asp National University of Computers & Emerging Sciences, Islamabad Email: ahsan@cluxing.com
  • 3. Ahsan Abdullah 3 NormalizationNormalization What is normalization? What are the goals of normalization?  Eliminate redundant data.  Ensure data dependencies make sense. What is the result of normalization? What are the levels of normalization? Always follow purists approach of normalization? NONO
  • 4. Ahsan Abdullah 4 NormalizationNormalization 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
  • 5. Ahsan Abdullah 5 Normalization: 1NFNormalization: 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
  • 6. Ahsan Abdullah 6 Normalization: 1NFNormalization: 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.
  • 7. Ahsan Abdullah 7 Normalization: 2NFNormalization: 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
  • 8. Ahsan Abdullah 8 Normalization: 2NFNormalization: 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
  • 9. Ahsan Abdullah 9 Normalization: 2NFNormalization: 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. Why there are anomalies? The table is in 2NF but NOT in 3NF
  • 10. Ahsan Abdullah 10 Normalization: 3NFNormalization: 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 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.
  • 11. Ahsan Abdullah 11 Normalization: 3NFNormalization: 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.
  • 12. Ahsan Abdullah 12 Normalization: 3NFNormalization: 3NF PeshawarPhD5 IslamabadBS4 LahoreMS3 LahoreMS2 IslamabadBS1 CampusDegreeSID REGISTRATION Peshawar5 Islamabad4 Lahore3 Lahore2 Islamabad1 CampusSID STUDENT_CAMPUS PhDPeshawar MSLahore BSIslamabad DegreeCampus CAMPUS_DEGREE
  • 13. Ahsan Abdullah 13 Normalization: 3NFNormalization: 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.
  • 14. Ahsan Abdullah 14 NormalizationNormalization 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. <number>
  2. <number>
  3. <number>
  4. <number>
  5. <number>
  6. <number>
  7. <number>
  8. <number>
  9. <number>
  10. <number>
  11. <number>
  12. <number>