Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 1
4 General Normal Form Definitions (For
Multiple Keys) (1)
The above definitions consider the primary key
only
The following more general definitions take into
account relations with multiple candidate keys
A relation schema R is in second normal form
(2NF) if every non-prime attribute A in R is fully
functionally dependent on every key of R
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 2
General Normal Form Definitions (2)
Definition:
Superkey of relation schema R - a set of attributes
S of R that contains a key of R
A relation schema R is in third normal form (3NF)
if whenever a FD X -> A holds in R, then either:
(a) X is a superkey of R, or
(b) A is a prime attribute of R
NOTE: Boyce-Codd normal form disallows
condition (b) above
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 3
5 BCNF (Boyce-Codd Normal Form)
A relation schema R is in Boyce-Codd Normal Form
(BCNF) if whenever an FD X -> A holds in R, then X is a
superkey of R
Each normal form is strictly stronger than the previous
one
Every 2NF relation is in 1NF
Every 3NF relation is in 2NF
Every BCNF relation is in 3NF
There exist relations that are in 3NF but not in BCNF
The goal is to have each relation in BCNF (or 3NF)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 4
Boyce-Codd Normal Form
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 5
A relation TEACH that is in 3NF but not in
BCNF
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 6
Achieving the BCNF by Decomposition (1)
Two FDs exist in the relation TEACH:
{student, course} is a candidate key for this relation and
that the dependencies shown follow the pattern in Figure
10.12 (b).
fd1: { student, course} -> instructor
fd2: instructor -> course
So this relation is in 3NF but not in BCNF
A relation NOT in BCNF should be decomposed so as to
meet this property, while possibly forgoing the
preservation of all functional dependencies in the
decomposed relations.
(See Algorithm 11.3)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 7
Achieving the BCNF by Decomposition (2)
Three possible decompositions for relation TEACH
{student, instructor} and {student, course}
{course, instructor } and {course, student}
{instructor, course } and {instructor, student}
All three decompositions will lose fd1.
We have to settle for sacrificing the functional dependency
preservation. But we cannot sacrifice the non-additivity property
after decomposition.
Out of the above three, only the 3rd decomposition will not generate
spurious tuples after join.(and hence has the non-additivity property).
A test to determine whether a binary decomposition (decomposition
into two relations) is non-additive (lossless) is discussed in section
11.1.4 under Property LJ1. Verify that the third decomposition above
meets the property.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 8
Denormalization
Transforming normalized relations into non-normalized
physical record specifications
Benefits:
Can improve performance (speed) by reducing number of table
lookups (i.e. reduce number of necessary join queries)
Costs (due to data duplication)
Wasted storage space
Data integrity/consistency threats
Common denormalization opportunities
One-to-one relationship (Fig. 5-3)
Many-to-many relationship with non-key attributes (associative
entity) (Fig. 5-4)
Reference data (1:N relationship where 1-side has data not used
in any other relationship) (Fig. 5-5)
9
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Figure 5-3 A possible denormalization situation: two entities with oneto-one relationship
Chapter 5
© 2013 Pearson Education
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
10
10
Figure 5-4 A possible denormalization situation: a many-to-many
relationship with nonkey attributes
Extra
table
access
required
Chapter 5
Null description
© 2013 Pearson Education
possible
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
11
11
Figure 5-5
A possible
denormalization
situation:
reference data
Extra
table
access
required
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Data
duplication
12
12
Denormalize with caution
Denormalization can
Increase chance of errors and inconsistencies
Reintroduce anomalies
Force reprogramming when business rules
change
Perhaps other methods could be used to
improve performance of joins
Organization of tables in the database (file
organization and clustering)
Proper query design and optimization
13
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Partitioning
Horizontal Partitioning: Distributing the rows of a
logical relation into several separate tables
Vertical Partitioning: Distributing the columns of
a logical relation into several separate physical
tables
Useful for situations where different users need access
to different rows
Three types: Key Range Partitioning, Hash Partitioning,
or Composite Partitioning
Useful for situations where different users need access
to different columns
The primary key must be repeated in each file
Combinations of Horizontal and Vertical
14
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Partitioning
Horizontal Partitioning: Distributing the rows of a
logical relation into several separate tables
Vertical Partitioning: Distributing the columns of
a logical relation into several separate physical
tables
Useful for situations where different users need access
to different rows
Three types: Key Range Partitioning, Hash Partitioning,
or Composite Partitioning
Useful for situations where different users need access
to different columns
The primary key must be repeated in each file
Combinations of Horizontal and Vertical
15
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Partitioning pros and cons
16
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Oracle’s Horizontal Partitioning
Range partitioning
Hash partitioning
Partitions defined via hash functions
Will guarantee balanced distribution of rows
Partition could contain widely varying valued fields
List partitioning
Partitions defined by range of field values
Could result in unbalanced distribution of rows
Like-valued fields share partitions
Based on predefined lists of values for the partitioning
key
Composite partitioning
Combination of the other approaches
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
17
Chapter Summary
Informal Design Guidelines for Relational
Databases
Functional Dependencies (FDs)
Definition, Inference Rules, Equivalence of Sets of
FDs, Minimal Sets of FDs
Normal Forms Based on Primary Keys
General Normal Form Definitions (For Multiple
Keys)
BCNF (Boyce-Codd Normal Form)
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley
Slide 10- 18
© Copyright 2026 Paperzz