SlideShare a Scribd company logo
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

PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatin
Mudasir Syed
 
BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUST
Zuhair khayyat
 
Normalization
NormalizationNormalization
Database management system session 5
Database management system session 5Database management system session 5
Database management system session 5
Infinity Tech Solutions
 
Database Normalization.ppt
Database Normalization.pptDatabase Normalization.ppt
Database Normalization.ppt
sabi ben
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
FaizanBashirSidhu
 
normalization in Database Management Systems.ppt
normalization in Database Management Systems.pptnormalization in Database Management Systems.ppt
normalization in Database Management Systems.ppt
mohsinkhanscientist
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
Infotech27
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
niteshkumar334392
 
normalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tablesnormalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tables
dharawagh9999
 
Kumar lav
Kumar lavKumar lav
Kumar lav
kumar Lav
 
Normal forms
Normal formsNormal forms
Normal forms
Samuel Igbanogu
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
Rai University
 
Normalization
NormalizationNormalization
Normalization
Masud Parves
 
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
 
Normalization
NormalizationNormalization
Normalization
Subramanyam Neelam
 
Mca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query languageMca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query language
Rai University
 
Normalization
NormalizationNormalization
Normalization
Rajeev Srivastava
 
Normalization
NormalizationNormalization
Normalization
rey501
 
On Relevant Query Answering over Streaming and Distributed Data
On Relevant Query Answering over Streaming and Distributed DataOn Relevant Query Answering over Streaming and Distributed Data
On Relevant Query Answering over Streaming and Distributed Data
Shima Zahmatkesh
 

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

PHP mysql Database normalizatin
PHP mysql  Database normalizatinPHP mysql  Database normalizatin
PHP mysql Database normalizatin
 
BigDansing presentation slides for KAUST
BigDansing presentation slides for KAUSTBigDansing presentation slides for KAUST
BigDansing presentation slides for KAUST
 
Normalization
NormalizationNormalization
Normalization
 
Database management system session 5
Database management system session 5Database management system session 5
Database management system session 5
 
Database Normalization.ppt
Database Normalization.pptDatabase Normalization.ppt
Database Normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization in Database Management Systems.ppt
normalization in Database Management Systems.pptnormalization in Database Management Systems.ppt
normalization in Database Management Systems.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization.ppt
normalization.pptnormalization.ppt
normalization.ppt
 
normalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tablesnormalization-Normalization -Process of Divide Tables
normalization-Normalization -Process of Divide Tables
 
Kumar lav
Kumar lavKumar lav
Kumar lav
 
Normal forms
Normal formsNormal forms
Normal forms
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
 
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
 
Mca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query languageMca ii-dbms-u-iv-structured query language
Mca ii-dbms-u-iv-structured query language
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
On Relevant Query Answering over Streaming and Distributed Data
On Relevant Query Answering over Streaming and Distributed DataOn Relevant Query Answering over Streaming and Distributed Data
On Relevant Query Answering over Streaming and Distributed Data
 

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.pdf
samaghorab
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdf
samaghorab
 
Lec_1_Integration.ppt
Lec_1_Integration.pptLec_1_Integration.ppt
Lec_1_Integration.ppt
samaghorab
 
L2Web.pptx
L2Web.pptxL2Web.pptx
L2Web.pptx
samaghorab
 
L6.pdf
L6.pdfL6.pdf
L6.pdf
samaghorab
 
Lecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdfLecture-1-2-+(1).pdf
Lecture-1-2-+(1).pdf
samaghorab
 
Intro_to_data_base.pdf
Intro_to_data_base.pdfIntro_to_data_base.pdf
Intro_to_data_base.pdf
samaghorab
 
5941981.ppt
5941981.ppt5941981.ppt
5941981.ppt
samaghorab
 
programs+ifelse&+for.pptx
programs+ifelse&+for.pptxprograms+ifelse&+for.pptx
programs+ifelse&+for.pptx
samaghorab
 
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
samaghorab
 
Python_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptxPython_Session05_Homeworkquestions.pptx
Python_Session05_Homeworkquestions.pptx
samaghorab
 

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

Milton Keynes Hospital Charity - A guide to leaving a gift in your Will
Milton Keynes Hospital Charity - A guide to leaving a gift in your WillMilton Keynes Hospital Charity - A guide to leaving a gift in your Will
Milton Keynes Hospital Charity - A guide to leaving a gift in your Will
fundraising4
 
PPT Item # 4 - 434 College Blvd. (sign. review)
PPT Item # 4 - 434 College Blvd. (sign. review)PPT Item # 4 - 434 College Blvd. (sign. review)
PPT Item # 4 - 434 College Blvd. (sign. review)
ahcitycouncil
 
PPT Item # 7 - 231 Encino Avenue (sign. review)
PPT Item # 7 - 231 Encino Avenue (sign. review)PPT Item # 7 - 231 Encino Avenue (sign. review)
PPT Item # 7 - 231 Encino Avenue (sign. review)
ahcitycouncil
 
PPT Item # 8&9 - Demolition Code Amendments
PPT Item # 8&9 - Demolition Code AmendmentsPPT Item # 8&9 - Demolition Code Amendments
PPT Item # 8&9 - Demolition Code Amendments
ahcitycouncil
 
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
Congressional Budget Office
 
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
3woawyyl
 
About Potato, The scientific name of the plant is Solanum tuberosum (L).
About Potato, The scientific name of the plant is Solanum tuberosum (L).About Potato, The scientific name of the plant is Solanum tuberosum (L).
About Potato, The scientific name of the plant is Solanum tuberosum (L).
Christina Parmionova
 
A guide to the International day of Potatoes 2024 - May 30th
A guide to the International day of Potatoes 2024 - May 30thA guide to the International day of Potatoes 2024 - May 30th
A guide to the International day of Potatoes 2024 - May 30th
Christina Parmionova
 
CFYT Rolling Ads Dawson City Yukon Canada
CFYT Rolling Ads Dawson City Yukon CanadaCFYT Rolling Ads Dawson City Yukon Canada
CFYT Rolling Ads Dawson City Yukon Canada
pmenzies
 
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
3woawyyl
 
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
OECDregions
 
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
ssuser05e8f3
 
2024: The FAR - Federal Acquisition Regulations, Part 41
2024: The FAR - Federal Acquisition Regulations, Part 412024: The FAR - Federal Acquisition Regulations, Part 41
2024: The FAR - Federal Acquisition Regulations, Part 41
JSchaus & Associates
 
Border towns and spaces of (in)visibility.pdf
Border towns and spaces of (in)visibility.pdfBorder towns and spaces of (in)visibility.pdf
Border towns and spaces of (in)visibility.pdf
Scalabrini Institute for Human Mobility in Africa
 
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
Christina Parmionova
 
World Food Safety Day 2024- Communication-toolkit.
World Food Safety Day 2024- Communication-toolkit.World Food Safety Day 2024- Communication-toolkit.
World Food Safety Day 2024- Communication-toolkit.
Christina Parmionova
 
IEA World Energy Investment June 2024- Statistics
IEA World Energy Investment June 2024- StatisticsIEA World Energy Investment June 2024- Statistics
IEA World Energy Investment June 2024- Statistics
Energy for One World
 
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptxPUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
Marked12
 
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
yemqpj
 
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
Jamesadhikaram land matter consultancy 9447464502
 

Recently uploaded (20)

Milton Keynes Hospital Charity - A guide to leaving a gift in your Will
Milton Keynes Hospital Charity - A guide to leaving a gift in your WillMilton Keynes Hospital Charity - A guide to leaving a gift in your Will
Milton Keynes Hospital Charity - A guide to leaving a gift in your Will
 
PPT Item # 4 - 434 College Blvd. (sign. review)
PPT Item # 4 - 434 College Blvd. (sign. review)PPT Item # 4 - 434 College Blvd. (sign. review)
PPT Item # 4 - 434 College Blvd. (sign. review)
 
PPT Item # 7 - 231 Encino Avenue (sign. review)
PPT Item # 7 - 231 Encino Avenue (sign. review)PPT Item # 7 - 231 Encino Avenue (sign. review)
PPT Item # 7 - 231 Encino Avenue (sign. review)
 
PPT Item # 8&9 - Demolition Code Amendments
PPT Item # 8&9 - Demolition Code AmendmentsPPT Item # 8&9 - Demolition Code Amendments
PPT Item # 8&9 - Demolition Code Amendments
 
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
CBO’s Outlook for U.S. Fertility Rates: 2024 to 2054
 
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
快速办理(Bristol毕业证书)布里斯托大学毕业证Offer一模一样
 
About Potato, The scientific name of the plant is Solanum tuberosum (L).
About Potato, The scientific name of the plant is Solanum tuberosum (L).About Potato, The scientific name of the plant is Solanum tuberosum (L).
About Potato, The scientific name of the plant is Solanum tuberosum (L).
 
A guide to the International day of Potatoes 2024 - May 30th
A guide to the International day of Potatoes 2024 - May 30thA guide to the International day of Potatoes 2024 - May 30th
A guide to the International day of Potatoes 2024 - May 30th
 
CFYT Rolling Ads Dawson City Yukon Canada
CFYT Rolling Ads Dawson City Yukon CanadaCFYT Rolling Ads Dawson City Yukon Canada
CFYT Rolling Ads Dawson City Yukon Canada
 
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
原版制作(英国Southampton毕业证书)南安普顿大学毕业证录取通知书一模一样
 
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
Preliminary findings _OECD field visits to ten regions in the TSI EU mining r...
 
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
Bangladesh studies presentation on Liberation War 1971 Indepence-of-Banglades...
 
2024: The FAR - Federal Acquisition Regulations, Part 41
2024: The FAR - Federal Acquisition Regulations, Part 412024: The FAR - Federal Acquisition Regulations, Part 41
2024: The FAR - Federal Acquisition Regulations, Part 41
 
Border towns and spaces of (in)visibility.pdf
Border towns and spaces of (in)visibility.pdfBorder towns and spaces of (in)visibility.pdf
Border towns and spaces of (in)visibility.pdf
 
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
Combined Illegal, Unregulated and Unreported (IUU) Vessel List.
 
World Food Safety Day 2024- Communication-toolkit.
World Food Safety Day 2024- Communication-toolkit.World Food Safety Day 2024- Communication-toolkit.
World Food Safety Day 2024- Communication-toolkit.
 
IEA World Energy Investment June 2024- Statistics
IEA World Energy Investment June 2024- StatisticsIEA World Energy Investment June 2024- Statistics
IEA World Energy Investment June 2024- Statistics
 
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptxPUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
PUBLIC FINANCIAL MANAGEMENT SYSTEM (PFMS) and DBT.pptx
 
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
在线办理(ISU毕业证书)爱荷华州立大学毕业证学历证书一模一样
 
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
Indira P.S Vs sub Collector Kochi - The settlement register is not a holy cow...
 

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!