Lecture 4
Lecture 4
Normalization
Purpose of Normalization
2
Purpose of Normalization
Characteristics of a suitable set of relations
include:
– the minimal number of attributes necessary
to support the data requirements of the
enterprise;
– attributes with a close logical relationship
are found in the same relation;
– minimal redundancy with each attribute
represented only once with the important
exception of attributes that form all or part
of foreign keys.
3
Purpose of Normalization
4
How Normalization Supports Database
Design
5
Data Redundancy and Update Anomalies
6
Data Redundancy and Update Anomalies
7
Data Redundancy and Update Anomalies
8
Data Redundancy and Update Anomalies
9
Data Redundancy and Update Anomalies
StaffBranch relation has redundant data; the
details of a branch are repeated for every
member of staff.
10
Data Redundancy and Update Anomalies
11
Lossless-join and Dependency Preservation
Properties
12
Functional Dependencies
Diagrammatic representation.
15
Example Functional Dependency that holds
for all Time
Consider the values shown in staffNo and
sName attributes of the Staff relation (Slide 9).
staffNo → sName
sName → staffNo
16
Example Functional Dependency that holds
for all Time
staffNo → sName
17
Characteristics of Functional Dependencies
18
Characteristics of Functional Dependencies
19
Example Full Functional Dependency
Exists in the Staff relation (see Slide 9).
22
Example Transitive Dependency
Consider functional dependencies in the
StaffBranch relation (see Slide 9).
23
The Process of Normalization
24
Identifying Functional Dependencies
Identifying all functional dependencies
between a set of attributes is relatively simple if
the meaning of each attribute and the
relationships between the attributes are well
understood.
25
Identifying Functional Dependencies
26
Example - Identifying a set of functional
dependencies for the StaffBranch relation
27
Example - Identifying a set of functional
dependencies for the StaffBranch relation
29
Example - Using sample data to identify
functional dependencies.
30
Example - Using sample data to identify
functional dependencies.
A→C (fd1)
C→A (fd2)
B →D (fd3)
A, B → E (fd4)
31
Identifying the Primary Key for a Relation
using Functional Dependencies
32
Example - Identify Primary Key for
StaffBranch Relation
34
Example - Identifying Primary Key for
Sample Relation
Sample relation has four functional
dependencies.
36
The Process of Normalization
37
The Process of Normalization
38
Unnormalized Form (UNF)
39
First Normal Form (1NF)
40
UNF to 1NF
41
UNF to 1NF
42
Second Normal Form (2NF)
43
Second Normal Form (2NF)
44
1NF to 2NF
45
Third Normal Form (3NF)
46
Third Normal Form (3NF)
47
2NF to 3NF
48
General Definitions of 2NF and 3NF
Second normal form (2NF)
– A relation that is in first normal form and
every non-primary-key attribute is fully
functionally dependent on any candidate key.