SlideShare a Scribd company logo
Lec 08: Normalization
BCA 20: DATABASE MANAGEMENT SYSTEM
AND PROGRAMMING
Department of Information Systems
College of Computer Studies
Xavier University – Ateneo de Cagayan
Review
1. What is a Table?
2. What is a Column?
3. What is a Row?
The Apparel Store Case Study
In preparation for next
year’s sale event, a
certain apparel shop is
coming up with ideas for
the Item database.
Analyze the table on the
succeeding slide, and see
how you can improve on it.
tbl_Items
Item Colors Price Tax
T-shirt Red 12.00 0.60
Polo Red 12.00 0.60
Sweatshirt Blue 12.00 0.60
Anomalies
The above table might be sufficient for a simple database,
but later on, errors (or anomalies) can occur when using it.
There are three general types of anomalies: Updation,
Insertion, and Deletion.
tbl_Items
Item Colors Price Tax
T-shirt Red,blue 12.00 0.60
Polo Red, Yellow 12.00 0.60
T-shirt Red, Black 12.00 0.60
Sweatshirt Blue, Black 12.00 0.60
Updation Anomaly
For example, to update the colors of the item where it
occurs twice or more than twice in a table, we will have to
update column in all the rows, or else data will become
inconsistent.
tbl_Items
Item Colors Price Tax
T-shirt Red,blue 12.00 0.60
Polo Red, Yellow 12.00 0.60
T-shirt Red, Black 12.00 0.60
Sweatshirt Blue, Black 12.00 0.60
Insertion Anomaly
Suppose for a new item, we have the item and color of the
item but if it has not opted for a price yet then we have to insert
NULL in there, leading to an Insertion Anomaly.
tbl_Items
Item Colors Price Tax
T-shirt Red,blue 12.00 0.60
Polo Red, Yellow 12.00 0.60
T-shirt Red, Black 12.00 0.60
Sweatshirt Blue, Black 12.00 0.60
Deletion Anomaly
Likewise, if one item was suggested to be drops, then
during the time when we delete that row, the entire item record
will have to be deleted along with it.
tbl_Items
Item Colors Price Tax
T-shirt Red,blue 12.00 0.60
Polo Red, Yellow 12.00 0.60
T-shirt Red, Black 12.00 0.60
Sweatshirt Blue, Black 12.00 0.60
The Solution
Through Normalization, we can make sure that the data
are logically arranged. Usually there are 5 levels of normal
forms, but usually 3rd normal form is sufficient for most typical
database applications:
There are three steps in the Normalization process:
First Normal Form (1NF);
Second Normal Form (2NF); and
Third Normal Form (3NF)
Normalization
Normalization is a technique
of organizing data in a
database through the
systematic decomposition of
tables in order to eliminate
data redundancies and
anomalies.
Normalization
These anomalies refer to
Insertion, Updation, and
Deletion Anomalies.
Normalization
Normalization ensures that
redundant data is eliminated,
and data is logically stored
(i.e. data dependencies make
sense).
The Apparel Store Case Study
Let’s see how we can
apply normalization to the
Registrar’s database.
First Normal Form
In First Normal Form, no two Rows
of data must contain repeating
group of information (i.e each set
of column must have a unique or
single value).
Each table should be organized
into rows, and each row should
have a primary key.
The Primary Key
The Primary Key is a single column
(or a combination of two or more
columns) that uniquely identifies
each row.
We will use primary keys to help
us in the Normalization process.
First Normal Form
Remember, in First Normal Form,
each row must not have a column
in which more than one value is
saved (liked separated with
commas). Also, each row must be
unique and distinguished by a
primary key.
tbl_Student1NF will now look like
this:
tbl_Items
Item Colors Price Tax
T-shirt Red,blue 12.00 0.60
Polo Red, Yellow 12.00 0.60
T-shirt Red, Black 12.00 0.60
Sweatshirt Blue, Black 12.00 0.60
First Normal Form
Table is not in 1st normal form
because:
- Multiple items in color field
- Duplicate records / no
primary key
SOLUTION:
BREAK IT DOWN
tbl_Items
Item Colors Price Tax
T-shirt Red 12.00 0.60
T-shirt Blue 12.00 0.60
Polo Red 12.00 0.60
Polo Yellow 12.00 0.60
Sweatshirt Blue 12.00 0.60
Sweatshirt Black 12.00 0.60
Second
Normal Form
A table in Second Normal Form
must first be in First Normal Form,
and it must not have any partial
dependencies.
All non-key fields depend on all
components of the primary key,
guaranteed when primary key is a
single field.
Partial Dependency
A Partial Dependency refers to
non-key attributes which are only
dependent on part of the primary
key (aka the composite primary
key).
Let’s take a look at table and see
how this applies.
tbl_Items
Item Colors Price Tax
T-shirt Red 12.00 0.60
T-shirt Blue 12.00 0.60
Polo Red 12.00 0.60
Polo Yellow 12.00 0.60
Sweatshirt Blue 12.00 0.60
Sweatshirt Black 12.00 0.60
Second
Normal Form
Table is not in second normal form
because:
- PRICE and TAX depend on ITEM,
but not COLOR
tbl_ColorItem
Item Color
T-shirt Red
T-shirt Blue
Polo Red
Polo Yellow
Sweatshirt Blue
Sweatshirt Black
Item Price Tax
T-shirt 12.00 0.60
Polo 12.00 0.60
Sweatshirt 12.00 0.60
tbl_PriceItem
Third Normal Form
Tables in Third Normal Form must
first be in Second Normal Form,
and all non-prime attributes of
each table must be dependent on
the primary key.
Transitive
Dependency
A Transitive Dependency refers to
non key attributes which
dependent on another non key
attribute.
Third Normal Form
Tables in Third Normal Form must
first be in Second Normal Form,
and all non-prime attributes of
each table must be dependent on
the primary key.
Let’s look at a table again:
tbl_ColorItem
Item Color
T-shirt Red
T-shirt Blue
Polo Red
Polo Yellow
Sweatshirt Blue
Sweatshirt Black
Item Price Tax
T-shirt 12.00 0.60
Polo 12.00 0.60
Sweatshirt 12.00 0.60
tbl_PriceItem
Third Normal Form
Tables are not in third normal form
because:
- TAX depends on PRICE, not ITEM
tbl_ColorItem
Item Color
T-shirt Red
T-shirt Blue
Polo Red
Polo Yellow
Sweatshirt Blue
Sweatshirt Black
Item Price
T-shirt 12.00
Polo 12.00
Sweatshirt 12.00
tbl_PriceItem
Price Tax
12.00 0.60
tbl_Tax
Another Example
Name Assignment A Assignment B
Jeff Smith Article Summary Poetry Analysis
Nancy Jones Article Summary Reaction Paper
Jane Scott Article Summary Poetry Analysis
Table_Assignment
Problem:
Table is not in first normal form because:
- Assignment field repeating
- First and last name in one field
- No (guaranteed unique) primary key field
Solution:
Break down the field NAME
into First Name, and Last
Name.
tbl_Assignment
First Name Last Name Assignment 1 Assignment 2
Jeff Smith Article Summary Poetry Analysis
Nancy Jones Article Summary Reaction Paper
Jane Scott Article Summary Poetry Analysis
No Primary Key??
Ans: CREATE ANOTHER FIELD
in this case name it Student
ID
tbl_Assignment
Student ID First Name Last Name Assignment 1 Assignment 2
1 Jeff Smith
Article
Summary
Poetry
Analysis
2 Nancy Jones
Article
Summary
Reaction
Paper
3 Jane Scott
Article
Summary
Poetry
Analysis
Seems okay right?
Look again in the table
tbl_Assignment
Student ID First Name Last Name Assignment 1 Assignment 2
1 Jeff Smith
Article
Summary
Poetry
Analysis
2 Nancy Jones
Article
Summary
Reaction
Paper
3 Jane Scott
Article
Summary
Poetry
Analysis
Solution:
Assignment field repeating
Solution:
Create a new fields
(Assignment ID &
Description)
tbl_Assignment
Student ID First Name Last Name Assignment ID Description
1 Jeff Smith A Article Summary
1 Jeff Smith B Poetry Analysis
2 Nancy Jones A Article Summary
2 Nancy Jones C Reaction Paper
3 Jane Scott A Article Summary
3 Jane Scott B Poetry Analysis
Table is not in 2NF since:
- Description does not
depend on Student ID
tbl_Assignment
Student ID First Name Last Name Assignment ID Description
1 Jeff Smith A Article Summary
1 Jeff Smith B Poetry Analysis
2 Nancy Jones A Article Summary
2 Nancy Jones C Reaction Paper
3 Jane Scott A Article Summary
3 Jane Scott B Poetry Analysis
tbl_Student
Student ID
First
Name
Last
Name
1 Jeff Smith
2 Nancy Jones
3 Jane Scott
Student
ID
Assignment
ID
Description
1 A Article Summary
1 B Poetry Analysis
2 A Article Summary
2 C Reaction Paper
3 A Article Summary
3 B Poetry Analysis
tbl_Assignment
Table is not in 3NF since:
-Description does not depend
still on Student ID
-Data Repetition
tbl_Student
Student ID First Name
Last
Name
1 Jeff Smith
2 Nancy Jones
3 Jane Scott
Student
ID
Assignment
ID
1 A
2 A
3 A
1 B
3 B
2 C
tbl_Assignment
Assignment
ID
Description
1 Article Summary
2 Poetry Analysis
3 Reaction Paper
tbl_Descript
Normalization for Non-IT Professionals
While the process of Normalization can be tricky for non-IT
students and professionals, everyone should still be able to
create logically-sound databases in the Third Normal Form.
Summary
Normalization is the systematic decomposition of tables in order to
eliminate data redundancies and anomalies. There are three normal
forms: 1NF, 2NF, and 3NF.
A Primary Key is a single column (or a combination of two or more
columns) that uniquely identifies each row.
A Partial Dependency refers to non-key attributes which are only
dependent on part of the primary key.
A Transitive Dependency refers to non key attributes which dependent on
another non key attribute.
Exercise 1
Normalize the following “Pet_Health” table to 3NF:
Pet_ID Pet_Name Pet_Type Pet_Age Owner
771 Rover Dog 12 Sam Villa
204 Spot Dog 2 Anna Dy
348 Mrs Whiskers Cat 4 Sam Villa
Exercise 2
Item_ID Item_Name Item_Desc
Supplier_Na
me
Address PO_num PO_date
A101 BckBP
One box of
black ballpens
De Oro Office
Supplies
Cagayan de
Oro City
20986 12-11-2014
A102 BluBP
One box of
blue ballpens
De Oro Office
Supplies
Cagayan de
Oro City
20986 12-11-2014
P100 SBP
One ream of
short bond
paper
King Papers
Cagayan de
Oro City
1217
02-10-2011
P100 SBP
One ream of
short bond
paper
Office Depot Iligan City 21044 01-05-2015
End
References:
www.lib.ku.edu/instruction
Ad

More Related Content

What's hot (20)

Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
college
 
Tree in data structure
Tree in data structureTree in data structure
Tree in data structure
ghhgj jhgh
 
Database management system presentation
Database management system presentationDatabase management system presentation
Database management system presentation
sameerraaj
 
Normalization
NormalizationNormalization
Normalization
Salman Memon
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Prateek Parimal
 
Database anomalies
Database anomaliesDatabase anomalies
Database anomalies
baabtra.com - No. 1 supplier of quality freshers
 
Abstract data types
Abstract data typesAbstract data types
Abstract data types
Poojith Chowdhary
 
Database, Lecture-1.ppt
Database, Lecture-1.pptDatabase, Lecture-1.ppt
Database, Lecture-1.ppt
MatshushimaSumaya
 
2 tier and 3 tier architecture
2 tier and 3 tier architecture2 tier and 3 tier architecture
2 tier and 3 tier architecture
baabtra.com - No. 1 supplier of quality freshers
 
Ir 02
Ir   02Ir   02
Ir 02
Mohammed Romi
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
Harsiddhi Thakkar
 
Database Management System, Lecture-1
Database Management System, Lecture-1Database Management System, Lecture-1
Database Management System, Lecture-1
Sonia Mim
 
Unit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 CompleteUnit 1: Introduction to DBMS Unit 1 Complete
Unit 1: Introduction to DBMS Unit 1 Complete
Raj vardhan
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
Megha yadav
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
Nishant Munjal
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
Arun Sharma
 
Data mining :Concepts and Techniques Chapter 2, data
Data mining :Concepts and Techniques Chapter 2, dataData mining :Concepts and Techniques Chapter 2, data
Data mining :Concepts and Techniques Chapter 2, data
Salah Amean
 
Data structures and algorithms
Data structures and algorithmsData structures and algorithms
Data structures and algorithms
Julie Iskander
 
History of Database
History  of DatabaseHistory  of Database
History of Database
Talesun Solar USA Ltd.
 
Data base management system (2)
Data base management system (2)Data base management system (2)
Data base management system (2)
MrinalDev1
 

Viewers also liked (11)

Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 
Normalization Accepted
Normalization AcceptedNormalization Accepted
Normalization Accepted
prasaddurga
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependency
avniS
 
Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
Pratik Devmurari
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
daxesh chauhan
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
Roshni Singh
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databases
Jafar Nesargi
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
Tamajit Chakraborty
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Prateek Parimal
 
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
Oum Saokosal
 
DBMS - Normalization
DBMS - NormalizationDBMS - Normalization
DBMS - Normalization
Jitendra Tomar
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 
Normalization Accepted
Normalization AcceptedNormalization Accepted
Normalization Accepted
prasaddurga
 
Multivalued dependency
Multivalued dependencyMultivalued dependency
Multivalued dependency
avniS
 
Functional dependencies and normalization
Functional dependencies and normalizationFunctional dependencies and normalization
Functional dependencies and normalization
daxesh chauhan
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
Roshni Singh
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databases
Jafar Nesargi
 
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
Oum Saokosal
 
Ad

Similar to DBMS Lecture 8 - Normalization (13)

SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptxSS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
oforjose30
 
Normalization
NormalizationNormalization
Normalization
Shakila Mahjabin
 
Normalization
NormalizationNormalization
Normalization
Ramesh 4
 
Lecture 4 Applied Econometrics and Economic Modeling
Lecture 4 Applied Econometrics and Economic ModelingLecture 4 Applied Econometrics and Economic Modeling
Lecture 4 Applied Econometrics and Economic Modeling
stone55
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
arjunstores123
 
Lesson 002
Lesson 002Lesson 002
Lesson 002
Ning Ding
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
NIDHISAHU71
 
Roja128
Roja128Roja128
Roja128
meherdeepu
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
Sunita Milind Dol
 
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docxBUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
curwenmichaela
 
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docxBUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
jasoninnes20
 
Session02
Session02Session02
Session02
guest9510e2
 
ProbabilityandStatsUnitAPowerpoint-1.pptx
ProbabilityandStatsUnitAPowerpoint-1.pptxProbabilityandStatsUnitAPowerpoint-1.pptx
ProbabilityandStatsUnitAPowerpoint-1.pptx
KristinaWirt
 
SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptxSS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
SS3 NORMALISATION HANDOUT EASY TO UNDERSTAND(1).pptx
oforjose30
 
Normalization
NormalizationNormalization
Normalization
Ramesh 4
 
Lecture 4 Applied Econometrics and Economic Modeling
Lecture 4 Applied Econometrics and Economic ModelingLecture 4 Applied Econometrics and Economic Modeling
Lecture 4 Applied Econometrics and Economic Modeling
stone55
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
arjunstores123
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
NIDHISAHU71
 
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docxBUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
curwenmichaela
 
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docxBUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
BUS 308 Week 2 Lecture 3 Setting up the F and T tests in E.docx
jasoninnes20
 
ProbabilityandStatsUnitAPowerpoint-1.pptx
ProbabilityandStatsUnitAPowerpoint-1.pptxProbabilityandStatsUnitAPowerpoint-1.pptx
ProbabilityandStatsUnitAPowerpoint-1.pptx
KristinaWirt
 
Ad

Recently uploaded (20)

Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdfBiophysics Chapter 3 Methods of Studying Macromolecules.pdf
Biophysics Chapter 3 Methods of Studying Macromolecules.pdf
PKLI-Institute of Nursing and Allied Health Sciences Lahore , Pakistan.
 
Unit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdfUnit 6_Introduction_Phishing_Password Cracking.pdf
Unit 6_Introduction_Phishing_Password Cracking.pdf
KanchanPatil34
 
Handling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptxHandling Multiple Choice Responses: Fortune Effiong.pptx
Handling Multiple Choice Responses: Fortune Effiong.pptx
AuthorAIDNationalRes
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...Multi-currency in odoo accounting and Update exchange rates automatically in ...
Multi-currency in odoo accounting and Update exchange rates automatically in ...
Celine George
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
LDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini UpdatesLDMMIA Reiki Master Spring 2025 Mini Updates
LDMMIA Reiki Master Spring 2025 Mini Updates
LDM Mia eStudios
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 

DBMS Lecture 8 - Normalization

  • 1. Lec 08: Normalization BCA 20: DATABASE MANAGEMENT SYSTEM AND PROGRAMMING Department of Information Systems College of Computer Studies Xavier University – Ateneo de Cagayan
  • 2. Review 1. What is a Table? 2. What is a Column? 3. What is a Row?
  • 3. The Apparel Store Case Study In preparation for next year’s sale event, a certain apparel shop is coming up with ideas for the Item database. Analyze the table on the succeeding slide, and see how you can improve on it.
  • 4. tbl_Items Item Colors Price Tax T-shirt Red 12.00 0.60 Polo Red 12.00 0.60 Sweatshirt Blue 12.00 0.60
  • 5. Anomalies The above table might be sufficient for a simple database, but later on, errors (or anomalies) can occur when using it. There are three general types of anomalies: Updation, Insertion, and Deletion.
  • 6. tbl_Items Item Colors Price Tax T-shirt Red,blue 12.00 0.60 Polo Red, Yellow 12.00 0.60 T-shirt Red, Black 12.00 0.60 Sweatshirt Blue, Black 12.00 0.60
  • 7. Updation Anomaly For example, to update the colors of the item where it occurs twice or more than twice in a table, we will have to update column in all the rows, or else data will become inconsistent.
  • 8. tbl_Items Item Colors Price Tax T-shirt Red,blue 12.00 0.60 Polo Red, Yellow 12.00 0.60 T-shirt Red, Black 12.00 0.60 Sweatshirt Blue, Black 12.00 0.60
  • 9. Insertion Anomaly Suppose for a new item, we have the item and color of the item but if it has not opted for a price yet then we have to insert NULL in there, leading to an Insertion Anomaly.
  • 10. tbl_Items Item Colors Price Tax T-shirt Red,blue 12.00 0.60 Polo Red, Yellow 12.00 0.60 T-shirt Red, Black 12.00 0.60 Sweatshirt Blue, Black 12.00 0.60
  • 11. Deletion Anomaly Likewise, if one item was suggested to be drops, then during the time when we delete that row, the entire item record will have to be deleted along with it.
  • 12. tbl_Items Item Colors Price Tax T-shirt Red,blue 12.00 0.60 Polo Red, Yellow 12.00 0.60 T-shirt Red, Black 12.00 0.60 Sweatshirt Blue, Black 12.00 0.60
  • 13. The Solution Through Normalization, we can make sure that the data are logically arranged. Usually there are 5 levels of normal forms, but usually 3rd normal form is sufficient for most typical database applications: There are three steps in the Normalization process: First Normal Form (1NF); Second Normal Form (2NF); and Third Normal Form (3NF)
  • 14. Normalization Normalization is a technique of organizing data in a database through the systematic decomposition of tables in order to eliminate data redundancies and anomalies.
  • 15. Normalization These anomalies refer to Insertion, Updation, and Deletion Anomalies.
  • 16. Normalization Normalization ensures that redundant data is eliminated, and data is logically stored (i.e. data dependencies make sense).
  • 17. The Apparel Store Case Study Let’s see how we can apply normalization to the Registrar’s database.
  • 18. First Normal Form In First Normal Form, no two Rows of data must contain repeating group of information (i.e each set of column must have a unique or single value). Each table should be organized into rows, and each row should have a primary key.
  • 19. The Primary Key The Primary Key is a single column (or a combination of two or more columns) that uniquely identifies each row. We will use primary keys to help us in the Normalization process.
  • 20. First Normal Form Remember, in First Normal Form, each row must not have a column in which more than one value is saved (liked separated with commas). Also, each row must be unique and distinguished by a primary key. tbl_Student1NF will now look like this:
  • 21. tbl_Items Item Colors Price Tax T-shirt Red,blue 12.00 0.60 Polo Red, Yellow 12.00 0.60 T-shirt Red, Black 12.00 0.60 Sweatshirt Blue, Black 12.00 0.60
  • 22. First Normal Form Table is not in 1st normal form because: - Multiple items in color field - Duplicate records / no primary key SOLUTION: BREAK IT DOWN
  • 23. tbl_Items Item Colors Price Tax T-shirt Red 12.00 0.60 T-shirt Blue 12.00 0.60 Polo Red 12.00 0.60 Polo Yellow 12.00 0.60 Sweatshirt Blue 12.00 0.60 Sweatshirt Black 12.00 0.60
  • 24. Second Normal Form A table in Second Normal Form must first be in First Normal Form, and it must not have any partial dependencies. All non-key fields depend on all components of the primary key, guaranteed when primary key is a single field.
  • 25. Partial Dependency A Partial Dependency refers to non-key attributes which are only dependent on part of the primary key (aka the composite primary key). Let’s take a look at table and see how this applies.
  • 26. tbl_Items Item Colors Price Tax T-shirt Red 12.00 0.60 T-shirt Blue 12.00 0.60 Polo Red 12.00 0.60 Polo Yellow 12.00 0.60 Sweatshirt Blue 12.00 0.60 Sweatshirt Black 12.00 0.60
  • 27. Second Normal Form Table is not in second normal form because: - PRICE and TAX depend on ITEM, but not COLOR
  • 28. tbl_ColorItem Item Color T-shirt Red T-shirt Blue Polo Red Polo Yellow Sweatshirt Blue Sweatshirt Black Item Price Tax T-shirt 12.00 0.60 Polo 12.00 0.60 Sweatshirt 12.00 0.60 tbl_PriceItem
  • 29. Third Normal Form Tables in Third Normal Form must first be in Second Normal Form, and all non-prime attributes of each table must be dependent on the primary key.
  • 30. Transitive Dependency A Transitive Dependency refers to non key attributes which dependent on another non key attribute.
  • 31. Third Normal Form Tables in Third Normal Form must first be in Second Normal Form, and all non-prime attributes of each table must be dependent on the primary key. Let’s look at a table again:
  • 32. tbl_ColorItem Item Color T-shirt Red T-shirt Blue Polo Red Polo Yellow Sweatshirt Blue Sweatshirt Black Item Price Tax T-shirt 12.00 0.60 Polo 12.00 0.60 Sweatshirt 12.00 0.60 tbl_PriceItem
  • 33. Third Normal Form Tables are not in third normal form because: - TAX depends on PRICE, not ITEM
  • 34. tbl_ColorItem Item Color T-shirt Red T-shirt Blue Polo Red Polo Yellow Sweatshirt Blue Sweatshirt Black Item Price T-shirt 12.00 Polo 12.00 Sweatshirt 12.00 tbl_PriceItem Price Tax 12.00 0.60 tbl_Tax
  • 36. Name Assignment A Assignment B Jeff Smith Article Summary Poetry Analysis Nancy Jones Article Summary Reaction Paper Jane Scott Article Summary Poetry Analysis Table_Assignment
  • 37. Problem: Table is not in first normal form because: - Assignment field repeating - First and last name in one field - No (guaranteed unique) primary key field
  • 38. Solution: Break down the field NAME into First Name, and Last Name.
  • 39. tbl_Assignment First Name Last Name Assignment 1 Assignment 2 Jeff Smith Article Summary Poetry Analysis Nancy Jones Article Summary Reaction Paper Jane Scott Article Summary Poetry Analysis
  • 40. No Primary Key?? Ans: CREATE ANOTHER FIELD in this case name it Student ID
  • 41. tbl_Assignment Student ID First Name Last Name Assignment 1 Assignment 2 1 Jeff Smith Article Summary Poetry Analysis 2 Nancy Jones Article Summary Reaction Paper 3 Jane Scott Article Summary Poetry Analysis
  • 42. Seems okay right? Look again in the table
  • 43. tbl_Assignment Student ID First Name Last Name Assignment 1 Assignment 2 1 Jeff Smith Article Summary Poetry Analysis 2 Nancy Jones Article Summary Reaction Paper 3 Jane Scott Article Summary Poetry Analysis
  • 44. Solution: Assignment field repeating Solution: Create a new fields (Assignment ID & Description)
  • 45. tbl_Assignment Student ID First Name Last Name Assignment ID Description 1 Jeff Smith A Article Summary 1 Jeff Smith B Poetry Analysis 2 Nancy Jones A Article Summary 2 Nancy Jones C Reaction Paper 3 Jane Scott A Article Summary 3 Jane Scott B Poetry Analysis
  • 46. Table is not in 2NF since: - Description does not depend on Student ID
  • 47. tbl_Assignment Student ID First Name Last Name Assignment ID Description 1 Jeff Smith A Article Summary 1 Jeff Smith B Poetry Analysis 2 Nancy Jones A Article Summary 2 Nancy Jones C Reaction Paper 3 Jane Scott A Article Summary 3 Jane Scott B Poetry Analysis
  • 48. tbl_Student Student ID First Name Last Name 1 Jeff Smith 2 Nancy Jones 3 Jane Scott Student ID Assignment ID Description 1 A Article Summary 1 B Poetry Analysis 2 A Article Summary 2 C Reaction Paper 3 A Article Summary 3 B Poetry Analysis tbl_Assignment
  • 49. Table is not in 3NF since: -Description does not depend still on Student ID -Data Repetition
  • 50. tbl_Student Student ID First Name Last Name 1 Jeff Smith 2 Nancy Jones 3 Jane Scott Student ID Assignment ID 1 A 2 A 3 A 1 B 3 B 2 C tbl_Assignment Assignment ID Description 1 Article Summary 2 Poetry Analysis 3 Reaction Paper tbl_Descript
  • 51. Normalization for Non-IT Professionals While the process of Normalization can be tricky for non-IT students and professionals, everyone should still be able to create logically-sound databases in the Third Normal Form.
  • 52. Summary Normalization is the systematic decomposition of tables in order to eliminate data redundancies and anomalies. There are three normal forms: 1NF, 2NF, and 3NF. A Primary Key is a single column (or a combination of two or more columns) that uniquely identifies each row. A Partial Dependency refers to non-key attributes which are only dependent on part of the primary key. A Transitive Dependency refers to non key attributes which dependent on another non key attribute.
  • 53. Exercise 1 Normalize the following “Pet_Health” table to 3NF: Pet_ID Pet_Name Pet_Type Pet_Age Owner 771 Rover Dog 12 Sam Villa 204 Spot Dog 2 Anna Dy 348 Mrs Whiskers Cat 4 Sam Villa
  • 54. Exercise 2 Item_ID Item_Name Item_Desc Supplier_Na me Address PO_num PO_date A101 BckBP One box of black ballpens De Oro Office Supplies Cagayan de Oro City 20986 12-11-2014 A102 BluBP One box of blue ballpens De Oro Office Supplies Cagayan de Oro City 20986 12-11-2014 P100 SBP One ream of short bond paper King Papers Cagayan de Oro City 1217 02-10-2011 P100 SBP One ream of short bond paper Office Depot Iligan City 21044 01-05-2015