SlideShare a Scribd company logo
1 of 32
Download to read offline
Database
Chapter 3: Normalization
Dr. Fatma M. Talaat
Chapter 3 Content:
1. Why Normalize?
2. Normalization
3. Dependencies
4. Normalization Example
2
Chapter 3: Normalization
1. Why Normalize?
• If your database is not normalized, it can be inaccurate,
slow, inefficient.
• It might not produce the data you expect, or want
(update and delete anomalies).
• It makes creating queries, forms, and reports are much
easier to design.
4
• Normalization: sequence of steps by which RDB is both created and improved.
Advantages of Normalization:
1. Get relations in more desirable form.
2. Make database more accurate and efficient.
3. Make creating queries easier.
4. Remove duplication.
2. Normalization
5
• Normalization: sequence of steps by which RDB is both created and improved.
2. Normalization (Normalization Flow)
• A relation is said to be in first normal form if the data is held in a two-
dimensional table with each attribute represented by an atomic value.
• The intersection of a row and a column must contain an indivisible value.
• Each row and column position in the table there exists one value, never a set
of values.
• All attributes are atomic - any single attribute must not be composed of
multiple attributes.
6
First Normal Form (1NF)
The data we would want to store could be expressed as:
Project
No
Project Name Employee No Employee Name Rate
category
Rate
1203 Madagascar
travel site
11 Jessica Brookes A £90
12 Andy Evans B £80
16 Max Fat C £70
1506 Online estate
agency
11 Jessica Brookes A £90
17 Alex Branton B £80
7
First Normal Form (1NF)
• The intersection of a row and a column must contain an
indivisible value
Project
No.
Project Name Employee
No.
Employee
Name
Rate
category
Rate
1203 Madagascar
travel site
11 Jessica
Brookes
A £90
1203 Madagascar
travel site
12 Andy Evans B £80
1203 Madagascat
travel site
16 Max Fat C £70
1506 Online estate
agency
11 Jessica
Brookes
A £90
1506 Online estate
agency
17 Alex Branton B £70
8
Project
No.
Project Name Employee
No.
Solution
Three problems become apparent with our current model:
Tables in a RDBMS use a simple grid structure
• All tables in an RDBMS need a key
• Data entry should be kept to a minimum
• Redundant data
9
First Normal Form (1NF)
10
1NF:
• Relation is said to be in 1NF if data is held in a table with each attribute is
represented by atomic value.
2NF:
• Relation is said to be in 2NF if:
1) It is in 1NF.
2) Remove partial dependency.
Normalization (Normalization Flow)
11
3NF:
• Relation is said to be in 3NF if:
1) It is in 2NF.
2) Remove transitive dependency.
Normalization (Normalization Flow)
12
Partial dependency: when non-key attribute is determined by a part, but not all
composite P.K.
Transitive dependency: when non-key attribute determines another non-key
attribute.
3. Dependencies
• A relation is said to be in second normal form if the relation
(1) is in 1NF and (2) all attributes that are not part of the
primary key are completely functionally dependent on the
primary key. (Partial dependencies must be removed)
• Second Normal Form (2NF) the relation must be in 1NF and each
non key attribute must be fully dependent on the whole key (not a
subset of the key).
13
Second normal form 2NF
Third normal form 3NF
• A relation is said to be in 3NF if it (1) is in 2NF and (2) no
attributes that are not part of the primary key are transitively
dependent on the primary key.
• The key then to move 2NF relations into 3NF is removing any
transitive dependencies that may exist in the relations.
14
Dependencies: Definitions
• Partial Dependency – when an non-key attribute is determined by a
part, but not the whole, of a COMPOSITE primary key.
15
CUSTOMER
Cust_ID Name Order_ID
101 AT&T 1234
101 AT&T 156
125 Cisco 1250
Partial
Dependency
• Transitive Dependency – when a non-key attribute determines
another non-key attribute.
16
EMPLOYEE
Emp_ID F_Name L_Name Dept_ID Dept_Name
111 Mary Jones 1 Acct
122 Sarah Smith 2 Mktg
Transitive
Dependency
Dependencies: Definitions
Example 1
17
• Is the table in the 0NF
18
Studying dependency
1 NF
19
Partial dependency
2 NF
3 NF
20
.
Service Place
Service Type
Service Date
.
12/2002
3/2000
11/99
Service Type
Service Place
Service Type
Transitive Dependency
21
• What is meant by third normal form (3NF)? Examine the following table to
check if it is in 3NF. If yes, explain your answer. Otherwise convert the table
into 3NF.
4. Normalization Example
Client_no CName PropertyNo Address rent_start rent_end rent ownerNo oName
CR76 John kay
PG4
PG16
6 st.G
5 Novar
1-Jul-00
1-Sep-02
31-Aug-01
1-Sep-02
350
450
C040
C093
Tina
Tony
CR56 Aline Set
PG4
PG36
PG16
6 st.G
2 Manor
5 Novar
1-Sep-99
10-oct-00
1-Nov-02
10-Jun-00
1-Dec-01
1-Aug-03
350
370
450
C040
C093
C093
Tina
Tony
Tony
22
Solution:
3NF: Relation is said to be in 3NF if:
1) It is in 2NF.
2) Remove transitive dependency.
• It is not in 3NF.
4. Normalization Example (Ex.1): Solution
23
1) 1NF: make each attribute is represented by atomic value.
4. Normalization Example (Ex.1): Solution
Client_no CName PropertyNo Address rent_start rent_end rent ownerNo oName
CR76
CR76
John kay
John kay
PG4
PG16
6 st.G
5 Novar
1-Jul-00
1-Sep-02
31-Aug-01
1-Sep-02
350
450
C040
C093
Tina
Tony
CR56
CR56
CR56
Aline Set
Aline Set
Aline Set
PG4
PG36
PG16
6 st.G
2 Manor
5 Novar
1-Sep-99
10-oct-00
1-Nov-02
10-Jun-00
1-Dec-01
1-Aug-03
350
370
450
C040
C093
C093
Tina
Tony
Tony
24
Choose Client_no + PropertyNo  composite primary key
4. Normalization Example (Ex.1): Solution
Client_no PropertyNo CName Address rent_start rent_end rent ownerNo oName
CR76
CR76
PG4
PG16
John kay
John kay
6 st.G
5 Novar
1-Jul-00
1-Sep-02
31-Aug-01
1-Sep-02
350
450
C040
C093
Tina
Tony
CR56
CR56
CR56
PG4
PG36
PG16
Aline Set
Aline Set
Aline Set
6 st.G
2 Manor
5 Novar
1-Sep-99
10-oct-00
1-Nov-02
10-Jun-00
1-Dec-01
1-Aug-03
350
370
450
C040
C093
C093
Tina
Tony
Tony
25
2) 2NF: remove partial dependency
Client_no  CName
PropertyNo  Address, rent, ownerNo, oName
4. Normalization Example (Ex.1): Solution
Client_no PropertyNo rent_start rent_end
CR76
CR76
PG4
PG16
1-Jul-00
1-Sep-02
31-Aug-01
1-Sep-02
CR56
CR56
CR56
PG4
PG36
PG16
1-Sep-99
10-oct-00
1-Nov-02
10-Jun-00
1-Dec-01
1-Aug-03
Client_no CName
CR76 John kay
CR56 Aline Set
26
3) 3NF: remove transitive dependency
ownerNo  oName
4. Normalization Example (Ex.1): Solution
Client_no PropertyNo rent_start rent_end
CR76
CR76
PG4
PG16
1-Jul-00
1-Sep-02
31-Aug-01
1-Sep-02
CR56
CR56
CR56
PG4
PG36
PG16
1-Sep-99
10-oct-00
1-Nov-02
10-Jun-00
1-Dec-01
1-Aug-03
Client_no CName
CR76 John kay
CR56 Aline Set
PropertyNo Address rent ownerNo
PG4 6 st.G 350 C040
PG16 5 Novar 450 C093
PG36 2 Manor 370 C093
ownerNo oName
C040 Tina
C093 Tony
27
• Apply the various normalization steps to convert the following table into a
normal form.
4. Normalization Example (Ex.2)
Invoice
No.
Date
Cust.
No.
Cust.
Name
Cust.
Address
Cust.
City
Cust.
State
ItemID
Item
Description
Item.Q
ty
Item
Price
Item
Total
Order
total
price
125 9/13/2002 56 Foo, Inc.
23 Main
St,thorpleb
urg
thorpleb
urg
TX 563 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $
851 Spline End I 32 0.25 $ 8.00 $ 82.00 $
652 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $
126 9/14/2002 2
Freens R
Us
1600
Pennsylva
nia
Washing
ton
DC 563 56"Blue Fre 500 3.50 $
1750.00
$
10750.0
0 $
652 3' Red Fre 750 12.00 $
9000.00
$
10750.0
0 $
28
Solution:
• To be in 1NF
1) 1NF: make each attribute is represented by atomic value.
4. Normalization Example (Ex.2): Solution
Invoic
e No.
Date
Cust.No
.
Cust. Name
Cust.
Address
Cust. City
Cust.
State
ItemID
Item
Description
Item.Qt
y
Item Price Item Total
Order
total price
125 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebur
g
TX 563 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $
125 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebur
g
TX 851 Spline End I 32 0.25 $ 8.00 $ 82.00 $
125 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebur
g
TX 652 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $
126 9/14/2002 2
Freens R
Us
1600
Pennsylvani
a
Washingto
n
DC 563 56"Blue Fre 500 3.50 $ 1750.00 $
10750.00
$
126 9/14/2002 2
Freens R
Us
1600
Pennsylvani
a
Washingto
n
DC 652 3' Red Fre 750 12.00 $ 9000.00 $
10750.00
$
29
Choose Invoice No. + ItemID  composite primary key
4. Normalization Example (Ex.2): Solution
Invoice
No.
ItemID Date Cust.No. Cust. Name Cust. Address Cust. City
Cust.
State
Item
Description
Item.Qt
y
Item
Price
Item
Total
Order total price
125 563 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebu
rg
TX 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $
125 851 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebu
rg
TX Spline End I 32 0.25 $ 8.00 $ 82.00 $
125 652 9/13/2002 56 Foo, Inc.
23 Main
St,thorplebur
g
thorplebu
rg
TX 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $
126 563 9/14/2002 2
Freens R
Us
1600
Pennsylvania
Washingt
on
DC 56"Blue Fre 500 3.50 $
1750.0
0 $
10750.00 $
126 652 9/14/2002 2
Freens R
Us
1600
Pennsylvania
Washingt
on
DC 3' Red Fre 750 12.00 $
9000.0
0 $
10750.00 $
30
2) 2NF: remove partial dependency
Invoice No.  Date, Cust.No., Cust. Name, Cust. Address, Cust. City, Cust. State, Order
total price
ItemID  Item Description, Item Price
Invoice No. + ItemID  Item.Qty, Item Total
4. Normalization Example (Ex.2): Solution
Invoice No. ItemID Item.Qty Item Total
125 563 4 14.00 $
125 851 32 8.00 $
125 652 5 60.00 $
126 563 500 1750.00 $
126 652 750 9000.00 $
Invoice
No.
Date
Cust.N
o.
Cust.
Name
Cust.
Address
Cust.
City
Cust.
State
Order total
price
125 9/13/2002 56
Foo,
Inc.
23 Main
St,thorple
burg
thorple
burg
TX 82.00 $
126 9/14/2002 2
Freens
R Us
1600
Pennsylv
ania
Washi
ngton
DC 10750.00 $
ItemID Item Description Item Price
563 56"Blue Fre 3.50 $
851 Spline End I 0.25 $
652 3' Red Fre 12.00 $
31
3) 3NF: Tables are in 3 NF as there is no transitive dependency
4. Normalization Example (Ex.2): Solution
Thanks for your attention!

More Related Content

Similar to Chapter+3+-+Normalization.pdf

BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTZuhair khayyat
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Oum Saokosal
 
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdf
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdftransformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdf
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdfVictorManuelPedroEus
 
Normalization_BCA_
Normalization_BCA_Normalization_BCA_
Normalization_BCA_Bhavini Shah
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptxZoha681526
 
chap 10 dbms.pptx
chap 10 dbms.pptxchap 10 dbms.pptx
chap 10 dbms.pptxarjun431527
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptxAbdusSadik
 
ACL London User Group - Question Box Session
ACL London User Group - Question Box SessionACL London User Group - Question Box Session
ACL London User Group - Question Box SessionAlex Psarras
 
Cassandra : to be or not to be @ TechTalk
Cassandra : to be or not to be @ TechTalkCassandra : to be or not to be @ TechTalk
Cassandra : to be or not to be @ TechTalkAndriy Rymar
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAmazon Web Services
 
Distributech mega session 2.4.15
Distributech mega session   2.4.15Distributech mega session   2.4.15
Distributech mega session 2.4.15e9insightskate
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...DataStax
 

Similar to Chapter+3+-+Normalization.pdf (20)

BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUST
 
Database management system session 5
Database management system session 5Database management system session 5
Database management system session 5
 
Kumar lav
Kumar lavKumar lav
Kumar lav
 
Normalization
NormalizationNormalization
Normalization
 
Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)Database Concept - Normalization (1NF, 2NF, 3NF)
Database Concept - Normalization (1NF, 2NF, 3NF)
 
Normalization
NormalizationNormalization
Normalization
 
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdf
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdftransformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdf
transformer-engineering-design-technology-and-diagnostics-second-edition-pdf.pdf
 
Normalisation
NormalisationNormalisation
Normalisation
 
Normalization_BCA_
Normalization_BCA_Normalization_BCA_
Normalization_BCA_
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
Advanced Computational Drug Design
Advanced Computational Drug DesignAdvanced Computational Drug Design
Advanced Computational Drug Design
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Cadillac CN Series
Cadillac CN SeriesCadillac CN Series
Cadillac CN Series
 
chap 10 dbms.pptx
chap 10 dbms.pptxchap 10 dbms.pptx
chap 10 dbms.pptx
 
normalization ppt.pptx
normalization ppt.pptxnormalization ppt.pptx
normalization ppt.pptx
 
ACL London User Group - Question Box Session
ACL London User Group - Question Box SessionACL London User Group - Question Box Session
ACL London User Group - Question Box Session
 
Cassandra : to be or not to be @ TechTalk
Cassandra : to be or not to be @ TechTalkCassandra : to be or not to be @ TechTalk
Cassandra : to be or not to be @ TechTalk
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
 
Distributech mega session 2.4.15
Distributech mega session   2.4.15Distributech mega session   2.4.15
Distributech mega session 2.4.15
 
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
What is in All of Those SSTable Files Not Just the Data One but All the Rest ...
 

More from samaghorab

Lec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdfLec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdfsamaghorab
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfsamaghorab
 
Lec_1_Integration.ppt
Lec_1_Integration.pptLec_1_Integration.ppt
Lec_1_Integration.pptsamaghorab
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfsamaghorab
 
Intro_to_data_base.pdf
Intro_to_data_base.pdfIntro_to_data_base.pdf
Intro_to_data_base.pdfsamaghorab
 
programs+ifelse&+for.pptx
programs+ifelse&+for.pptxprograms+ifelse&+for.pptx
programs+ifelse&+for.pptxsamaghorab
 
Bioinformatics-Lec+4-DNADamage-and-Repair.pptx
Bioinformatics-Lec+4-DNADamage-and-Repair.pptxBioinformatics-Lec+4-DNADamage-and-Repair.pptx
Bioinformatics-Lec+4-DNADamage-and-Repair.pptxsamaghorab
 
Python_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptxPython_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptxsamaghorab
 

More from samaghorab (11)

Lec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdfLec+3-Introduction-to-Distributed-Systems.pdf
Lec+3-Introduction-to-Distributed-Systems.pdf
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdf
 
Lec_1_Integration.ppt
Lec_1_Integration.pptLec_1_Integration.ppt
Lec_1_Integration.ppt
 
L2Web.pptx
L2Web.pptxL2Web.pptx
L2Web.pptx
 
L6.pdf
L6.pdfL6.pdf
L6.pdf
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdf
 
Intro_to_data_base.pdf
Intro_to_data_base.pdfIntro_to_data_base.pdf
Intro_to_data_base.pdf
 
5941981.ppt
5941981.ppt5941981.ppt
5941981.ppt
 
programs+ifelse&+for.pptx
programs+ifelse&+for.pptxprograms+ifelse&+for.pptx
programs+ifelse&+for.pptx
 
Bioinformatics-Lec+4-DNADamage-and-Repair.pptx
Bioinformatics-Lec+4-DNADamage-and-Repair.pptxBioinformatics-Lec+4-DNADamage-and-Repair.pptx
Bioinformatics-Lec+4-DNADamage-and-Repair.pptx
 
Python_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptxPython_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptx
 

Recently uploaded

Fair Trash Reduction - West Hartford, CT
Fair Trash Reduction - West Hartford, CTFair Trash Reduction - West Hartford, CT
Fair Trash Reduction - West Hartford, CTaccounts329278
 
Top Rated Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...
Top Rated  Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...Top Rated  Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...
Top Rated Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...Call Girls in Nagpur High Profile
 
Climate change and occupational safety and health.
Climate change and occupational safety and health.Climate change and occupational safety and health.
Climate change and occupational safety and health.Christina Parmionova
 
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...anilsa9823
 
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...ranjana rawat
 
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Human-AI Collaboration for Virtual Capacity in Emergency Operation Centers (E...
Human-AI Collaborationfor Virtual Capacity in Emergency Operation Centers (E...Human-AI Collaborationfor Virtual Capacity in Emergency Operation Centers (E...
Human-AI Collaboration for Virtual Capacity in Emergency Operation Centers (E...Hemant Purohit
 
Regional Snapshot Atlanta Aging Trends 2024
Regional Snapshot Atlanta Aging Trends 2024Regional Snapshot Atlanta Aging Trends 2024
Regional Snapshot Atlanta Aging Trends 2024ARCResearch
 
CBO’s Recent Appeals for New Research on Health-Related Topics
CBO’s Recent Appeals for New Research on Health-Related TopicsCBO’s Recent Appeals for New Research on Health-Related Topics
CBO’s Recent Appeals for New Research on Health-Related TopicsCongressional Budget Office
 
The Economic and Organised Crime Office (EOCO) has been advised by the Office...
The Economic and Organised Crime Office (EOCO) has been advised by the Office...The Economic and Organised Crime Office (EOCO) has been advised by the Office...
The Economic and Organised Crime Office (EOCO) has been advised by the Office...nservice241
 
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Item # 4 - 231 Encino Ave (Significance Only).pdf
Item # 4 - 231 Encino Ave (Significance Only).pdfItem # 4 - 231 Encino Ave (Significance Only).pdf
Item # 4 - 231 Encino Ave (Significance Only).pdfahcitycouncil
 
2024: The FAR, Federal Acquisition Regulations - Part 28
2024: The FAR, Federal Acquisition Regulations - Part 282024: The FAR, Federal Acquisition Regulations - Part 28
2024: The FAR, Federal Acquisition Regulations - Part 28JSchaus & Associates
 
Junnar ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Junnar ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Junnar ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Junnar ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...tanu pandey
 
2024: The FAR, Federal Acquisition Regulations, Part 30
2024: The FAR, Federal Acquisition Regulations, Part 302024: The FAR, Federal Acquisition Regulations, Part 30
2024: The FAR, Federal Acquisition Regulations, Part 30JSchaus & Associates
 
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

Fair Trash Reduction - West Hartford, CT
Fair Trash Reduction - West Hartford, CTFair Trash Reduction - West Hartford, CT
Fair Trash Reduction - West Hartford, CT
 
Top Rated Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...
Top Rated  Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...Top Rated  Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...
Top Rated Pune Call Girls Hadapsar ⟟ 6297143586 ⟟ Call Me For Genuine Sex Se...
 
Climate change and occupational safety and health.
Climate change and occupational safety and health.Climate change and occupational safety and health.
Climate change and occupational safety and health.
 
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
Lucknow 💋 Russian Call Girls Lucknow ₹7.5k Pick Up & Drop With Cash Payment 8...
 
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service
(ANIKA) Call Girls Wadki ( 7001035870 ) HI-Fi Pune Escorts Service
 
Delhi Russian Call Girls In Connaught Place ➡️9999965857 India's Finest Model...
Delhi Russian Call Girls In Connaught Place ➡️9999965857 India's Finest Model...Delhi Russian Call Girls In Connaught Place ➡️9999965857 India's Finest Model...
Delhi Russian Call Girls In Connaught Place ➡️9999965857 India's Finest Model...
 
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...
The Most Attractive Pune Call Girls Handewadi Road 8250192130 Will You Miss T...
 
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service
(TARA) Call Girls Chakan ( 7001035870 ) HI-Fi Pune Escorts Service
 
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service
(DIVYA) Call Girls Wakad ( 7001035870 ) HI-Fi Pune Escorts Service
 
Human-AI Collaboration for Virtual Capacity in Emergency Operation Centers (E...
Human-AI Collaborationfor Virtual Capacity in Emergency Operation Centers (E...Human-AI Collaborationfor Virtual Capacity in Emergency Operation Centers (E...
Human-AI Collaboration for Virtual Capacity in Emergency Operation Centers (E...
 
Regional Snapshot Atlanta Aging Trends 2024
Regional Snapshot Atlanta Aging Trends 2024Regional Snapshot Atlanta Aging Trends 2024
Regional Snapshot Atlanta Aging Trends 2024
 
CBO’s Recent Appeals for New Research on Health-Related Topics
CBO’s Recent Appeals for New Research on Health-Related TopicsCBO’s Recent Appeals for New Research on Health-Related Topics
CBO’s Recent Appeals for New Research on Health-Related Topics
 
The Economic and Organised Crime Office (EOCO) has been advised by the Office...
The Economic and Organised Crime Office (EOCO) has been advised by the Office...The Economic and Organised Crime Office (EOCO) has been advised by the Office...
The Economic and Organised Crime Office (EOCO) has been advised by the Office...
 
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Nanded City Call Me 7737669865 Budget Friendly No Advance Booking
 
Item # 4 - 231 Encino Ave (Significance Only).pdf
Item # 4 - 231 Encino Ave (Significance Only).pdfItem # 4 - 231 Encino Ave (Significance Only).pdf
Item # 4 - 231 Encino Ave (Significance Only).pdf
 
Call Girls Service Connaught Place @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
Call Girls Service Connaught Place @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...Call Girls Service Connaught Place @9999965857 Delhi 🫦 No Advance  VVIP 🍎 SER...
Call Girls Service Connaught Place @9999965857 Delhi 🫦 No Advance VVIP 🍎 SER...
 
2024: The FAR, Federal Acquisition Regulations - Part 28
2024: The FAR, Federal Acquisition Regulations - Part 282024: The FAR, Federal Acquisition Regulations - Part 28
2024: The FAR, Federal Acquisition Regulations - Part 28
 
Junnar ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
Junnar ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...Junnar ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For S...
Junnar ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For S...
 
2024: The FAR, Federal Acquisition Regulations, Part 30
2024: The FAR, Federal Acquisition Regulations, Part 302024: The FAR, Federal Acquisition Regulations, Part 30
2024: The FAR, Federal Acquisition Regulations, Part 30
 
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service
(PRIYA) Call Girls Rajgurunagar ( 7001035870 ) HI-Fi Pune Escorts Service
 

Chapter+3+-+Normalization.pdf

  • 2. Chapter 3 Content: 1. Why Normalize? 2. Normalization 3. Dependencies 4. Normalization Example 2 Chapter 3: Normalization
  • 3. 1. Why Normalize? • If your database is not normalized, it can be inaccurate, slow, inefficient. • It might not produce the data you expect, or want (update and delete anomalies). • It makes creating queries, forms, and reports are much easier to design.
  • 4. 4 • Normalization: sequence of steps by which RDB is both created and improved. Advantages of Normalization: 1. Get relations in more desirable form. 2. Make database more accurate and efficient. 3. Make creating queries easier. 4. Remove duplication. 2. Normalization
  • 5. 5 • Normalization: sequence of steps by which RDB is both created and improved. 2. Normalization (Normalization Flow)
  • 6. • A relation is said to be in first normal form if the data is held in a two- dimensional table with each attribute represented by an atomic value. • The intersection of a row and a column must contain an indivisible value. • Each row and column position in the table there exists one value, never a set of values. • All attributes are atomic - any single attribute must not be composed of multiple attributes. 6 First Normal Form (1NF)
  • 7. The data we would want to store could be expressed as: Project No Project Name Employee No Employee Name Rate category Rate 1203 Madagascar travel site 11 Jessica Brookes A £90 12 Andy Evans B £80 16 Max Fat C £70 1506 Online estate agency 11 Jessica Brookes A £90 17 Alex Branton B £80 7 First Normal Form (1NF)
  • 8. • The intersection of a row and a column must contain an indivisible value Project No. Project Name Employee No. Employee Name Rate category Rate 1203 Madagascar travel site 11 Jessica Brookes A £90 1203 Madagascar travel site 12 Andy Evans B £80 1203 Madagascat travel site 16 Max Fat C £70 1506 Online estate agency 11 Jessica Brookes A £90 1506 Online estate agency 17 Alex Branton B £70 8 Project No. Project Name Employee No. Solution
  • 9. Three problems become apparent with our current model: Tables in a RDBMS use a simple grid structure • All tables in an RDBMS need a key • Data entry should be kept to a minimum • Redundant data 9 First Normal Form (1NF)
  • 10. 10 1NF: • Relation is said to be in 1NF if data is held in a table with each attribute is represented by atomic value. 2NF: • Relation is said to be in 2NF if: 1) It is in 1NF. 2) Remove partial dependency. Normalization (Normalization Flow)
  • 11. 11 3NF: • Relation is said to be in 3NF if: 1) It is in 2NF. 2) Remove transitive dependency. Normalization (Normalization Flow)
  • 12. 12 Partial dependency: when non-key attribute is determined by a part, but not all composite P.K. Transitive dependency: when non-key attribute determines another non-key attribute. 3. Dependencies
  • 13. • A relation is said to be in second normal form if the relation (1) is in 1NF and (2) all attributes that are not part of the primary key are completely functionally dependent on the primary key. (Partial dependencies must be removed) • Second Normal Form (2NF) the relation must be in 1NF and each non key attribute must be fully dependent on the whole key (not a subset of the key). 13 Second normal form 2NF
  • 14. Third normal form 3NF • A relation is said to be in 3NF if it (1) is in 2NF and (2) no attributes that are not part of the primary key are transitively dependent on the primary key. • The key then to move 2NF relations into 3NF is removing any transitive dependencies that may exist in the relations. 14
  • 15. Dependencies: Definitions • Partial Dependency – when an non-key attribute is determined by a part, but not the whole, of a COMPOSITE primary key. 15 CUSTOMER Cust_ID Name Order_ID 101 AT&T 1234 101 AT&T 156 125 Cisco 1250 Partial Dependency
  • 16. • Transitive Dependency – when a non-key attribute determines another non-key attribute. 16 EMPLOYEE Emp_ID F_Name L_Name Dept_ID Dept_Name 111 Mary Jones 1 Acct 122 Sarah Smith 2 Mktg Transitive Dependency Dependencies: Definitions
  • 17. Example 1 17 • Is the table in the 0NF
  • 20. 3 NF 20 . Service Place Service Type Service Date . 12/2002 3/2000 11/99 Service Type Service Place Service Type Transitive Dependency
  • 21. 21 • What is meant by third normal form (3NF)? Examine the following table to check if it is in 3NF. If yes, explain your answer. Otherwise convert the table into 3NF. 4. Normalization Example Client_no CName PropertyNo Address rent_start rent_end rent ownerNo oName CR76 John kay PG4 PG16 6 st.G 5 Novar 1-Jul-00 1-Sep-02 31-Aug-01 1-Sep-02 350 450 C040 C093 Tina Tony CR56 Aline Set PG4 PG36 PG16 6 st.G 2 Manor 5 Novar 1-Sep-99 10-oct-00 1-Nov-02 10-Jun-00 1-Dec-01 1-Aug-03 350 370 450 C040 C093 C093 Tina Tony Tony
  • 22. 22 Solution: 3NF: Relation is said to be in 3NF if: 1) It is in 2NF. 2) Remove transitive dependency. • It is not in 3NF. 4. Normalization Example (Ex.1): Solution
  • 23. 23 1) 1NF: make each attribute is represented by atomic value. 4. Normalization Example (Ex.1): Solution Client_no CName PropertyNo Address rent_start rent_end rent ownerNo oName CR76 CR76 John kay John kay PG4 PG16 6 st.G 5 Novar 1-Jul-00 1-Sep-02 31-Aug-01 1-Sep-02 350 450 C040 C093 Tina Tony CR56 CR56 CR56 Aline Set Aline Set Aline Set PG4 PG36 PG16 6 st.G 2 Manor 5 Novar 1-Sep-99 10-oct-00 1-Nov-02 10-Jun-00 1-Dec-01 1-Aug-03 350 370 450 C040 C093 C093 Tina Tony Tony
  • 24. 24 Choose Client_no + PropertyNo  composite primary key 4. Normalization Example (Ex.1): Solution Client_no PropertyNo CName Address rent_start rent_end rent ownerNo oName CR76 CR76 PG4 PG16 John kay John kay 6 st.G 5 Novar 1-Jul-00 1-Sep-02 31-Aug-01 1-Sep-02 350 450 C040 C093 Tina Tony CR56 CR56 CR56 PG4 PG36 PG16 Aline Set Aline Set Aline Set 6 st.G 2 Manor 5 Novar 1-Sep-99 10-oct-00 1-Nov-02 10-Jun-00 1-Dec-01 1-Aug-03 350 370 450 C040 C093 C093 Tina Tony Tony
  • 25. 25 2) 2NF: remove partial dependency Client_no  CName PropertyNo  Address, rent, ownerNo, oName 4. Normalization Example (Ex.1): Solution Client_no PropertyNo rent_start rent_end CR76 CR76 PG4 PG16 1-Jul-00 1-Sep-02 31-Aug-01 1-Sep-02 CR56 CR56 CR56 PG4 PG36 PG16 1-Sep-99 10-oct-00 1-Nov-02 10-Jun-00 1-Dec-01 1-Aug-03 Client_no CName CR76 John kay CR56 Aline Set
  • 26. 26 3) 3NF: remove transitive dependency ownerNo  oName 4. Normalization Example (Ex.1): Solution Client_no PropertyNo rent_start rent_end CR76 CR76 PG4 PG16 1-Jul-00 1-Sep-02 31-Aug-01 1-Sep-02 CR56 CR56 CR56 PG4 PG36 PG16 1-Sep-99 10-oct-00 1-Nov-02 10-Jun-00 1-Dec-01 1-Aug-03 Client_no CName CR76 John kay CR56 Aline Set PropertyNo Address rent ownerNo PG4 6 st.G 350 C040 PG16 5 Novar 450 C093 PG36 2 Manor 370 C093 ownerNo oName C040 Tina C093 Tony
  • 27. 27 • Apply the various normalization steps to convert the following table into a normal form. 4. Normalization Example (Ex.2) Invoice No. Date Cust. No. Cust. Name Cust. Address Cust. City Cust. State ItemID Item Description Item.Q ty Item Price Item Total Order total price 125 9/13/2002 56 Foo, Inc. 23 Main St,thorpleb urg thorpleb urg TX 563 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $ 851 Spline End I 32 0.25 $ 8.00 $ 82.00 $ 652 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $ 126 9/14/2002 2 Freens R Us 1600 Pennsylva nia Washing ton DC 563 56"Blue Fre 500 3.50 $ 1750.00 $ 10750.0 0 $ 652 3' Red Fre 750 12.00 $ 9000.00 $ 10750.0 0 $
  • 28. 28 Solution: • To be in 1NF 1) 1NF: make each attribute is represented by atomic value. 4. Normalization Example (Ex.2): Solution Invoic e No. Date Cust.No . Cust. Name Cust. Address Cust. City Cust. State ItemID Item Description Item.Qt y Item Price Item Total Order total price 125 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebur g TX 563 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $ 125 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebur g TX 851 Spline End I 32 0.25 $ 8.00 $ 82.00 $ 125 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebur g TX 652 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $ 126 9/14/2002 2 Freens R Us 1600 Pennsylvani a Washingto n DC 563 56"Blue Fre 500 3.50 $ 1750.00 $ 10750.00 $ 126 9/14/2002 2 Freens R Us 1600 Pennsylvani a Washingto n DC 652 3' Red Fre 750 12.00 $ 9000.00 $ 10750.00 $
  • 29. 29 Choose Invoice No. + ItemID  composite primary key 4. Normalization Example (Ex.2): Solution Invoice No. ItemID Date Cust.No. Cust. Name Cust. Address Cust. City Cust. State Item Description Item.Qt y Item Price Item Total Order total price 125 563 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebu rg TX 56"Blue Fre 4 3.50 $ 14.00 $ 82.00 $ 125 851 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebu rg TX Spline End I 32 0.25 $ 8.00 $ 82.00 $ 125 652 9/13/2002 56 Foo, Inc. 23 Main St,thorplebur g thorplebu rg TX 3' Red Fre 5 12.00 $ 60.00 $ 82.00 $ 126 563 9/14/2002 2 Freens R Us 1600 Pennsylvania Washingt on DC 56"Blue Fre 500 3.50 $ 1750.0 0 $ 10750.00 $ 126 652 9/14/2002 2 Freens R Us 1600 Pennsylvania Washingt on DC 3' Red Fre 750 12.00 $ 9000.0 0 $ 10750.00 $
  • 30. 30 2) 2NF: remove partial dependency Invoice No.  Date, Cust.No., Cust. Name, Cust. Address, Cust. City, Cust. State, Order total price ItemID  Item Description, Item Price Invoice No. + ItemID  Item.Qty, Item Total 4. Normalization Example (Ex.2): Solution Invoice No. ItemID Item.Qty Item Total 125 563 4 14.00 $ 125 851 32 8.00 $ 125 652 5 60.00 $ 126 563 500 1750.00 $ 126 652 750 9000.00 $ Invoice No. Date Cust.N o. Cust. Name Cust. Address Cust. City Cust. State Order total price 125 9/13/2002 56 Foo, Inc. 23 Main St,thorple burg thorple burg TX 82.00 $ 126 9/14/2002 2 Freens R Us 1600 Pennsylv ania Washi ngton DC 10750.00 $ ItemID Item Description Item Price 563 56"Blue Fre 3.50 $ 851 Spline End I 0.25 $ 652 3' Red Fre 12.00 $
  • 31. 31 3) 3NF: Tables are in 3 NF as there is no transitive dependency 4. Normalization Example (Ex.2): Solution
  • 32. Thanks for your attention!