SlideShare a Scribd company logo
Advanced Database Engineering
Advanced Database Engineering 1
1
Chapter 5:
Chapter 5:
Logical Database Design
Logical Database Design
and the Relational Model
and the Relational Model
Modern Database Management
Modern Database Management
7
7th
th
Edition
Edition
Jeffrey A. Hoffer, Mary B. Prescott,
Jeffrey A. Hoffer, Mary B. Prescott,
Fred R. McFadden
Fred R. McFadden
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 2
2
Data Normalization
Data Normalization
 Primarily a tool to validate and
Primarily a tool to validate and
improve a logical design so that it
improve a logical design so that it
satisfies certain constraints that
satisfies certain constraints that
avoid unnecessary duplication of
avoid unnecessary duplication of
data
data
 The process of decomposing
The process of decomposing
relations with anomalies to produce
relations with anomalies to produce
smaller,
smaller, well-structured
well-structured relations
relations
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 3
3
Well-Structured Relations
Well-Structured Relations
 A relation that contains minimal data redundancy
A relation that contains minimal data redundancy
and allows users to insert, delete, and update rows
and allows users to insert, delete, and update rows
without causing data inconsistencies
without causing data inconsistencies
 Goal is to avoid anomalies
Goal is to avoid anomalies
 Insertion Anomaly
Insertion Anomaly – adding new rows forces user to
– adding new rows forces user to
create duplicate data
create duplicate data
 Deletion Anomaly
Deletion Anomaly – deleting rows may cause a loss of
– deleting rows may cause a loss of
data that would be needed for other future rows
data that would be needed for other future rows
 Modification Anomaly
Modification Anomaly – changing data in a row forces
– changing data in a row forces
changes to other rows because of duplication
changes to other rows because of duplication
General rule of thumb: a table should not pertain to
more than one entity type
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 4
4
Example – Figure 5.2b
Example – Figure 5.2b
Question – Is this a relation? Answer – Yes: unique rows and no multivalued
attributes
Question – What’s the primary key? Answer – Composite: Emp_ID,
Course_Title
C++
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 5
5
Anomalies in this Table
Anomalies in this Table
 Insertion
Insertion – can’t enter a new employee without
– can’t enter a new employee without
having the employee take a class
having the employee take a class
 Deletion
Deletion – if we remove employee 140, we lose
– if we remove employee 140, we lose
information about the existence of a Tax Acc class
information about the existence of a Tax Acc class
 Modification
Modification – giving a salary increase to
– giving a salary increase to
employee 100 forces us to update multiple
employee 100 forces us to update multiple
records
records
Why do these anomalies exist?
Because there are two themes (entity types) into one
relation. This results in duplication, and an
unnecessary dependency between the entities
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 6
6
Functional Dependencies and Keys
Functional Dependencies and Keys
 Functional Dependency: The value of one
Functional Dependency: The value of one
attribute (the
attribute (the determinant
determinant) determines
) determines
the value of another attribute
the value of another attribute
 Candidate Key:
Candidate Key:
 A unique identifier. One of the candidate keys
A unique identifier. One of the candidate keys
will become the primary key
will become the primary key
 E.g. perhaps there is both credit card number and
E.g. perhaps there is both credit card number and
SS# in a table…in this case both are candidate keys
SS# in a table…in this case both are candidate keys
 Each non-key field is functionally dependent
Each non-key field is functionally dependent
on every candidate key
on every candidate key
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 7
7
Figure 5.22 -
Steps in
normalization
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 8
8
First Normal Form
First Normal Form
 No multivalued attributes
No multivalued attributes
 Every attribute value is atomic
Every attribute value is atomic
 Fig. 5-25
Fig. 5-25 is not
is not in 1
in 1st
st
Normal Form
Normal Form
(multivalued attributes)
(multivalued attributes) 
 it is not a relation
it is not a relation
 Fig. 5-26
Fig. 5-26 is
is in 1
in 1st
st
Normal form
Normal form
 All relations
All relations are in 1
are in 1st
st
Normal Form
Normal Form
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 9
9
Table with multivalued attributes, not in 1st
normal form
Note: this is NOT a relation
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 10
10
Table with no multivalued attributes and unique rows, in 1st
normal form
Note: this is relation, but not a well-structured one
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 11
11
Anomalies in this Table
Anomalies in this Table
 Insertion
Insertion – if new product is ordered for order
– if new product is ordered for order
1007 of existing customer, customer data must
1007 of existing customer, customer data must
be re-entered, causing duplication
be re-entered, causing duplication
 Deletion
Deletion – if we delete the Dining Table from
– if we delete the Dining Table from
Order 1006, we lose information concerning this
Order 1006, we lose information concerning this
item's finish and price
item's finish and price
 Update
Update – changing the price of product ID 4
– changing the price of product ID 4
requires update in several records
requires update in several records
Why do these anomalies exist?
Because there are multiple themes (entity types) into
one relation. This results in duplication, and an
unnecessary dependency between the entities
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 12
12
Second Normal Form
Second Normal Form
 1NF PLUS
1NF PLUS every non-key attribute is
every non-key attribute is
fully functionally dependent on the
fully functionally dependent on the
ENTIRE primary key
ENTIRE primary key
 Every non-key attribute must be defined
Every non-key attribute must be defined
by the entire key, not by only part of the
by the entire key, not by only part of the
key
key
 No partial functional dependencies
No partial functional dependencies
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 13
13
Order_ID  Order_Date, Customer_ID, Customer_Name, Customer_Address
Therefore, NOT in 2nd
Normal Form
Customer_ID  Customer_Name, Customer_Address
Product_ID  Product_Description, Product_Finish, Unit_Price
Order_ID, Product_ID  Order_Quantity
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 14
14
Getting it into Second Normal
Getting it into Second Normal
Form
Form
Partial Dependencies are removed, but there
are still transitive dependencies
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 15
15
Third Normal Form
Third Normal Form

2NF PLUS
2NF PLUS no transitive dependencies
no transitive dependencies
(functional dependencies on non-primary-key
(functional dependencies on non-primary-key
attributes)
attributes)
 Note: this is called transitive, because the
Note: this is called transitive, because the
primary key is a determinant for another
primary key is a determinant for another
attribute, which in turn is a determinant for a
attribute, which in turn is a determinant for a
third
third
 Solution: non-key determinant with transitive
Solution: non-key determinant with transitive
dependencies go into a new table; non-key
dependencies go into a new table; non-key
determinant becomes primary key in the new
determinant becomes primary key in the new
table and stays as foreign key in the old table
table and stays as foreign key in the old table
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 16
16
Getting it into Third Normal Form
Getting it into Third Normal Form
Transitive dependencies are removed
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 17
17
Merging Relations
Merging Relations
 View Integration – Combining entities from multiple
View Integration – Combining entities from multiple
ER models into common relations
ER models into common relations
 Issues to watch out for when merging entities from
Issues to watch out for when merging entities from
different ER models:
different ER models:
 Synonyms – two or more attributes with different names
Synonyms – two or more attributes with different names
but same meaning
but same meaning
 Homonyms – attributes with same name but different
Homonyms – attributes with same name but different
meanings
meanings
 Transitive dependencies – even if relations are in 3NF prior
Transitive dependencies – even if relations are in 3NF prior
to merging, they may not be after merging
to merging, they may not be after merging
 Supertype/subtype relationships – may be hidden prior to
Supertype/subtype relationships – may be hidden prior to
merging
merging
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 18
18
Enterprise Keys
Enterprise Keys
 Primary keys that are unique in the whole
Primary keys that are unique in the whole
database, not just within a single relation
database, not just within a single relation
 Corresponds with the concept of an object
Corresponds with the concept of an object
ID in object-oriented systems
ID in object-oriented systems
Chapter 5 Advanced Database Engineering
Advanced Database Engineering 19
19

More Related Content

PPTX
Lec 5.pptx
PPTX
Database Design and Normalization
PPT
Chapter12 designing databases
PPTX
Relational Database Design
PPTX
Database Engineering: Part one
PPTX
Distributed database
PPTX
T-SQL Overview
PPTX
Chap04 (normalization 1 2 3 form ).pptx
Lec 5.pptx
Database Design and Normalization
Chapter12 designing databases
Relational Database Design
Database Engineering: Part one
Distributed database
T-SQL Overview
Chap04 (normalization 1 2 3 form ).pptx

Similar to Lecture-8(a-b).ppt xx intro to management (20)

PDF
Database Management Systems 4 - Normalization
PPTX
database Normalization
PPTX
Database normalization
PPTX
Introduction to Database (Field + Record).pptx
PPTX
UNIT II DBMS.pptx
PPTX
2 The Relational Database Model_ chapter 2.pptx
PDF
Advanced Database Systems Ch 1 - Review.pdf
PPT
demo2.ppt
PPTX
04 CHAPTER FOUR - INTEGRITY CONSTRAINTS AND NORMALIZATION.pptx
PPTX
Data Modeling
PDF
Access 05
PPT
Database intro
PPTX
Ism normalization pine valley 2012
PPT
Chapter 14: Normalization and Transitive dependency
PDF
Understanding about relational database m-square systems inc
PPTX
L1-Normalization 1NF 2NF 3NF 4NF BCNF.pptx
PPT
ER Digramms by Harshal wagh
PPTX
Year 11 DATA PROCESSING 1st Term
PDF
MIT Normalization and its types with examples.pdf
PPT
Module 2 - part i
Database Management Systems 4 - Normalization
database Normalization
Database normalization
Introduction to Database (Field + Record).pptx
UNIT II DBMS.pptx
2 The Relational Database Model_ chapter 2.pptx
Advanced Database Systems Ch 1 - Review.pdf
demo2.ppt
04 CHAPTER FOUR - INTEGRITY CONSTRAINTS AND NORMALIZATION.pptx
Data Modeling
Access 05
Database intro
Ism normalization pine valley 2012
Chapter 14: Normalization and Transitive dependency
Understanding about relational database m-square systems inc
L1-Normalization 1NF 2NF 3NF 4NF BCNF.pptx
ER Digramms by Harshal wagh
Year 11 DATA PROCESSING 1st Term
MIT Normalization and its types with examples.pdf
Module 2 - part i
Ad

More from mee23nu (12)

PPTX
Metal alkyne complexes.pptx in chemistry
PPTX
Immobilize Enzymes Explain In Detail With Example Types And Advantage And Dis...
PPTX
biochemistry group 1.pptx chemistry bios
PPTX
Lecture No 03.pptx requirement engineering
PPT
Lecture-9-10-11-12(a-b).ppt modern database
PPTX
SRE lec 1.pptx software requirement and engineering
PPTX
management lec 8.pptx foundation of planning
PPTX
Presentation1 (1).spptx computer network
PPTX
lecture No-10.pptxREQUIREMNT ENGINEERING
PPTX
INFORMATION SECURITY PPT.pptx ON CYBER SECURITY
PPT
chapt_02.ppt PN COAL CH 03 SLIDES OF ASSEMBLY LANGUAGRE
PPTX
IPv4 & IPv6.pptx FOR COMPUTER NETWORK PRPCPTPS
Metal alkyne complexes.pptx in chemistry
Immobilize Enzymes Explain In Detail With Example Types And Advantage And Dis...
biochemistry group 1.pptx chemistry bios
Lecture No 03.pptx requirement engineering
Lecture-9-10-11-12(a-b).ppt modern database
SRE lec 1.pptx software requirement and engineering
management lec 8.pptx foundation of planning
Presentation1 (1).spptx computer network
lecture No-10.pptxREQUIREMNT ENGINEERING
INFORMATION SECURITY PPT.pptx ON CYBER SECURITY
chapt_02.ppt PN COAL CH 03 SLIDES OF ASSEMBLY LANGUAGRE
IPv4 & IPv6.pptx FOR COMPUTER NETWORK PRPCPTPS
Ad

Recently uploaded (20)

PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
web development for engineering and engineering
PPTX
CH1 Production IntroductoryConcepts.pptx
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
OOP with Java - Java Introduction (Basics)
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
Welding lecture in detail for understanding
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PDF
Digital Logic Computer Design lecture notes
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Construction Project Organization Group 2.pptx
Automation-in-Manufacturing-Chapter-Introduction.pdf
web development for engineering and engineering
CH1 Production IntroductoryConcepts.pptx
CYBER-CRIMES AND SECURITY A guide to understanding
Operating System & Kernel Study Guide-1 - converted.pdf
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
OOP with Java - Java Introduction (Basics)
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
Welding lecture in detail for understanding
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
bas. eng. economics group 4 presentation 1.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Embodied AI: Ushering in the Next Era of Intelligent Systems
Digital Logic Computer Design lecture notes
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Construction Project Organization Group 2.pptx

Lecture-8(a-b).ppt xx intro to management

  • 1. Advanced Database Engineering Advanced Database Engineering 1 1 Chapter 5: Chapter 5: Logical Database Design Logical Database Design and the Relational Model and the Relational Model Modern Database Management Modern Database Management 7 7th th Edition Edition Jeffrey A. Hoffer, Mary B. Prescott, Jeffrey A. Hoffer, Mary B. Prescott, Fred R. McFadden Fred R. McFadden
  • 2. Chapter 5 Advanced Database Engineering Advanced Database Engineering 2 2 Data Normalization Data Normalization  Primarily a tool to validate and Primarily a tool to validate and improve a logical design so that it improve a logical design so that it satisfies certain constraints that satisfies certain constraints that avoid unnecessary duplication of avoid unnecessary duplication of data data  The process of decomposing The process of decomposing relations with anomalies to produce relations with anomalies to produce smaller, smaller, well-structured well-structured relations relations
  • 3. Chapter 5 Advanced Database Engineering Advanced Database Engineering 3 3 Well-Structured Relations Well-Structured Relations  A relation that contains minimal data redundancy A relation that contains minimal data redundancy and allows users to insert, delete, and update rows and allows users to insert, delete, and update rows without causing data inconsistencies without causing data inconsistencies  Goal is to avoid anomalies Goal is to avoid anomalies  Insertion Anomaly Insertion Anomaly – adding new rows forces user to – adding new rows forces user to create duplicate data create duplicate data  Deletion Anomaly Deletion Anomaly – deleting rows may cause a loss of – deleting rows may cause a loss of data that would be needed for other future rows data that would be needed for other future rows  Modification Anomaly Modification Anomaly – changing data in a row forces – changing data in a row forces changes to other rows because of duplication changes to other rows because of duplication General rule of thumb: a table should not pertain to more than one entity type
  • 4. Chapter 5 Advanced Database Engineering Advanced Database Engineering 4 4 Example – Figure 5.2b Example – Figure 5.2b Question – Is this a relation? Answer – Yes: unique rows and no multivalued attributes Question – What’s the primary key? Answer – Composite: Emp_ID, Course_Title C++
  • 5. Chapter 5 Advanced Database Engineering Advanced Database Engineering 5 5 Anomalies in this Table Anomalies in this Table  Insertion Insertion – can’t enter a new employee without – can’t enter a new employee without having the employee take a class having the employee take a class  Deletion Deletion – if we remove employee 140, we lose – if we remove employee 140, we lose information about the existence of a Tax Acc class information about the existence of a Tax Acc class  Modification Modification – giving a salary increase to – giving a salary increase to employee 100 forces us to update multiple employee 100 forces us to update multiple records records Why do these anomalies exist? Because there are two themes (entity types) into one relation. This results in duplication, and an unnecessary dependency between the entities
  • 6. Chapter 5 Advanced Database Engineering Advanced Database Engineering 6 6 Functional Dependencies and Keys Functional Dependencies and Keys  Functional Dependency: The value of one Functional Dependency: The value of one attribute (the attribute (the determinant determinant) determines ) determines the value of another attribute the value of another attribute  Candidate Key: Candidate Key:  A unique identifier. One of the candidate keys A unique identifier. One of the candidate keys will become the primary key will become the primary key  E.g. perhaps there is both credit card number and E.g. perhaps there is both credit card number and SS# in a table…in this case both are candidate keys SS# in a table…in this case both are candidate keys  Each non-key field is functionally dependent Each non-key field is functionally dependent on every candidate key on every candidate key
  • 7. Chapter 5 Advanced Database Engineering Advanced Database Engineering 7 7 Figure 5.22 - Steps in normalization
  • 8. Chapter 5 Advanced Database Engineering Advanced Database Engineering 8 8 First Normal Form First Normal Form  No multivalued attributes No multivalued attributes  Every attribute value is atomic Every attribute value is atomic  Fig. 5-25 Fig. 5-25 is not is not in 1 in 1st st Normal Form Normal Form (multivalued attributes) (multivalued attributes)   it is not a relation it is not a relation  Fig. 5-26 Fig. 5-26 is is in 1 in 1st st Normal form Normal form  All relations All relations are in 1 are in 1st st Normal Form Normal Form
  • 9. Chapter 5 Advanced Database Engineering Advanced Database Engineering 9 9 Table with multivalued attributes, not in 1st normal form Note: this is NOT a relation
  • 10. Chapter 5 Advanced Database Engineering Advanced Database Engineering 10 10 Table with no multivalued attributes and unique rows, in 1st normal form Note: this is relation, but not a well-structured one
  • 11. Chapter 5 Advanced Database Engineering Advanced Database Engineering 11 11 Anomalies in this Table Anomalies in this Table  Insertion Insertion – if new product is ordered for order – if new product is ordered for order 1007 of existing customer, customer data must 1007 of existing customer, customer data must be re-entered, causing duplication be re-entered, causing duplication  Deletion Deletion – if we delete the Dining Table from – if we delete the Dining Table from Order 1006, we lose information concerning this Order 1006, we lose information concerning this item's finish and price item's finish and price  Update Update – changing the price of product ID 4 – changing the price of product ID 4 requires update in several records requires update in several records Why do these anomalies exist? Because there are multiple themes (entity types) into one relation. This results in duplication, and an unnecessary dependency between the entities
  • 12. Chapter 5 Advanced Database Engineering Advanced Database Engineering 12 12 Second Normal Form Second Normal Form  1NF PLUS 1NF PLUS every non-key attribute is every non-key attribute is fully functionally dependent on the fully functionally dependent on the ENTIRE primary key ENTIRE primary key  Every non-key attribute must be defined Every non-key attribute must be defined by the entire key, not by only part of the by the entire key, not by only part of the key key  No partial functional dependencies No partial functional dependencies
  • 13. Chapter 5 Advanced Database Engineering Advanced Database Engineering 13 13 Order_ID  Order_Date, Customer_ID, Customer_Name, Customer_Address Therefore, NOT in 2nd Normal Form Customer_ID  Customer_Name, Customer_Address Product_ID  Product_Description, Product_Finish, Unit_Price Order_ID, Product_ID  Order_Quantity
  • 14. Chapter 5 Advanced Database Engineering Advanced Database Engineering 14 14 Getting it into Second Normal Getting it into Second Normal Form Form Partial Dependencies are removed, but there are still transitive dependencies
  • 15. Chapter 5 Advanced Database Engineering Advanced Database Engineering 15 15 Third Normal Form Third Normal Form  2NF PLUS 2NF PLUS no transitive dependencies no transitive dependencies (functional dependencies on non-primary-key (functional dependencies on non-primary-key attributes) attributes)  Note: this is called transitive, because the Note: this is called transitive, because the primary key is a determinant for another primary key is a determinant for another attribute, which in turn is a determinant for a attribute, which in turn is a determinant for a third third  Solution: non-key determinant with transitive Solution: non-key determinant with transitive dependencies go into a new table; non-key dependencies go into a new table; non-key determinant becomes primary key in the new determinant becomes primary key in the new table and stays as foreign key in the old table table and stays as foreign key in the old table
  • 16. Chapter 5 Advanced Database Engineering Advanced Database Engineering 16 16 Getting it into Third Normal Form Getting it into Third Normal Form Transitive dependencies are removed
  • 17. Chapter 5 Advanced Database Engineering Advanced Database Engineering 17 17 Merging Relations Merging Relations  View Integration – Combining entities from multiple View Integration – Combining entities from multiple ER models into common relations ER models into common relations  Issues to watch out for when merging entities from Issues to watch out for when merging entities from different ER models: different ER models:  Synonyms – two or more attributes with different names Synonyms – two or more attributes with different names but same meaning but same meaning  Homonyms – attributes with same name but different Homonyms – attributes with same name but different meanings meanings  Transitive dependencies – even if relations are in 3NF prior Transitive dependencies – even if relations are in 3NF prior to merging, they may not be after merging to merging, they may not be after merging  Supertype/subtype relationships – may be hidden prior to Supertype/subtype relationships – may be hidden prior to merging merging
  • 18. Chapter 5 Advanced Database Engineering Advanced Database Engineering 18 18 Enterprise Keys Enterprise Keys  Primary keys that are unique in the whole Primary keys that are unique in the whole database, not just within a single relation database, not just within a single relation  Corresponds with the concept of an object Corresponds with the concept of an object ID in object-oriented systems ID in object-oriented systems
  • 19. Chapter 5 Advanced Database Engineering Advanced Database Engineering 19 19