Normalization
Normalization
Chapter 5
Database Systems:
Design, Implementation, and Management,
Seventh Edition, Rob and Coronel
1
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 2
5
• Normalization
– Process for evaluating and correcting table
structures to minimize data redundancies
• Reduces data anomalies
– Works through a series of stages called
normal forms:
• First normal form (1NF)
• Second normal form (2NF)
• Third normal form (3NF)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 3
5
Database Tables and Normalization
(continued)
• Normalization (continued)
– 2NF is better than 1NF; 3NF is better than
2NF
– For most business database design purposes,
3NF is as high as we need to go in
normalization process
– Highest level of normalization is not always
most desirable
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 4
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 5
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 6
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 7
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 8
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 9
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 10
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 12
5
Conversion to First Normal Form
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 13
5
Conversion to First Normal Form
(continued)
• Step 2: Identify the Primary Key
– Primary key must uniquely identify attribute
value
– New key must be composed
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 14
5
Conversion to First Normal Form
(continued)
• Step 3: Identify All Dependencies
– Dependencies can be depicted with help of a
diagram
– Dependency diagram:
• Depicts all dependencies found within given
table structure
• Helpful in getting bird’s-eye view of all
relationships among table’s attributes
• Makes it less likely that will overlook an
important dependency
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 15
5
Conversion to First Normal Form
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 16
5
Conversion to First Normal Form
(continued)
• First normal form describes tabular format in which:
– All key attributes are defined
– There are no repeating groups in the table
– All attributes are dependent on primary key
• All relational tables satisfy 1NF requirements
• Some tables contain partial dependencies
– Dependencies based on only part of the primary key
– Sometimes used for performance reasons, but should
be used with caution
– Still subject to data redundancies
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 17
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 18
5
Conversion to Second Normal Form
(continued)
• Step 1: Write Each Key Component
on a Separate Line
– Write each key component on separate line,
then write original (composite) key on last line
– Each component will become key in new table
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 19
5
Conversion to Second Normal Form
(continued)
• Step 2: Assign Corresponding Dependent
Attributes
– Determine those attributes that are dependent
on other attributes
– At this point, most anomalies have been
eliminated
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 20
5
Conversion to Second Normal Form
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 21
5
Conversion to Second Normal Form
(continued)
• Table is in second normal form (2NF) when:
– It is in 1NF and
– It includes no partial dependencies:
• No attribute is dependent on only portion of
primary key
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 22
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 23
5
Conversion to Third Normal Form
(continued)
• Step 2: Identify the Dependent Attributes
– Identify attributes dependent on each
determinant identified in Step 1 and identify
dependency
– Name table to reflect its contents and function
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 24
5
Conversion to Third Normal Form
(continued)
• Step 3: Remove the Dependent Attributes from
Transitive Dependencies
– Eliminate all dependent attributes in transitive
relationship(s) from each of the tables that have
such a transitive relationship
– Draw new dependency diagram to show all
tables defined in Steps 1–3
– Check new tables as well as tables modified in
Step 3 to make sure that each table has
determinant and that no table contains
inappropriate dependencies
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 25
5
Conversion to Third Normal Form
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 26
5
Conversion to Third Normal Form
(continued)
• A table is in third normal form (3NF) when
both of the following are true:
– It is in 2NF
– It contains no transitive dependencies
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 27
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 28
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 29
5
Improving the Design (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 30
5
Improving the Design (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 31
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 32
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 33
5
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 34
5
Normalization and Database Design
(continued)
• ER diagram
– Provides big picture, or macro view, of an
organization’s data requirements and
operations
– Created through an iterative process
• Identifying relevant entities, their attributes and
their relationship
• Use results to identify additional entities and
attributes
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 35
5
Normalization and Database Design
(continued)
• Normalization procedures
– Focus on characteristics of specific entities
– Represents micro view of entities within ER
diagram
• Difficult to separate normalization process
from ER modeling process
• Two techniques should be used concurrently
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 36
5
Normalization and Database Design
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 37
5
Normalization and Database Design
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 38
5
Normalization and Database Design
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 39
5
Normalization and Database Design
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 40
5
Normalization and Database Design
(continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 41
5
Denormalization
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 42
5
Denormalization (continued)
Denormalization (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 44
5
Denormalization (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 45
5
Summary
Summary (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 48
5
Summary (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 49
5
Summary (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 50
5
Summary (continued)
Database Systems: Design, Implementation, & Management, 7th Edition, Rob & Coronel 51