Normalization Consolidated 2003
Normalization Consolidated 2003
Functional Dependencies
The Process of Normalization
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
Fourth Normal Form (4NF)
Fifth Normal Form (5NF)
Domain Key Normal Form (DKNF)
A properly normalized database
should have the following
characteristics
Scalar values in each fields
Absence of redundancy.
Minimal use of null values.
Minimal loss of information.
Database normalization is the process of
removing redundant data from the tables to
improve storage efficiency, data integrity, and
scalability.
The process of normalization is a formal method
that identifies relations based on their primary
or candidate keys and the functional
dependencies among their attributes.
Normalization generally involves splitting
existing tables into multiple ones, which must
be re-joined or linked each time a query is
issued.
Levels of Normalization
Unnormalized – There are multivalued attributes or
repeating groups
First Normal Form (1NF) –
Redundancy
Third Normal Form (3NF)-
yti x el p mo C
Fourth Normal Form (4NF)
ba Tf o r eb mu N
Fifth Normal Form (5NF)
Each
Eachhigher
higherlevel
levelisisaasubset
subsetofofthe
thelower
lowerlevel
level
Edgar F. Codd first proposed the process of
normalization and what came to be known
as the 1st normal form in his paper A
Relational Model of Data for Large Shared
Data Banks Codd stated:
“There is, in fact, a very simple elimination
procedure which we shall call normalization.
Through decomposition non-simple domains
are replaced by ‘domains whose elements
are atomic (non-decomposable) values.’”
In the relational model, methods exist for
quantifying how efficient a database is. These
classifications are called normal forms (or
NF), and there are algorithms for converting
a given database between them.
Edgar F. Codd originally established three
normal forms: 1NF, 2NF and 3NF. There are
now others that are generally accepted, but
3NF is widely considered to be sufficient for
most applications. Most tables when reaching
3NF are also in BCNF (Boyce-Codd Normal
Form).
Repeating group = (propertyNo, pAddress,
rentStart, rentFinish, rent, ownerNo,
oName)
ClientNo cName propertyNo pAddress rentStart rentFinish rent ownerNo oName
CR76 John PG4 6 lawrence 1-Jul-00 31-Aug-01 350 CO40 Tina
kay St,Glasgow Murphy
PG16
5 Novar Dr, 1-Sep-02 1-Sep-02 450 CO93 Tony Shaw
Glasgow
Stud_ID Name
101 Lennon
125 Jonson
STUDENT_COURSE
CR56 PG16 Aline 5 Novar Dr, 1-Nov-02 1-Aug-03 450 CO93 Tony Shaw
Stewart Glasgow
ClientN propertyN pAddress rentStart rentFinis rent ownerNo oName
o o h
ClientNo cName CR76 PG4 6 lawrence 1-Jul-00 31-Aug-01 350 CO40 Tina
St,Glasgow Murphy
CR76 John Kay
CR56 Aline Stewart CR76 PG16 5 Novar Dr, 1-Sep-02 1-Sep-02 450 CO93 Tony
Glasgow Shaw
1 MySQL
2 Computers
Author Table
Author_ID Last Name First Name
Book Table
1 Silberschat Abraham
ISBN Title Pages Publisher z
007295886 Database System 1168 McGraw-Hill 2 Korth Henry
3 Concepts
0072958863 2 0072958863 1
0471694665 1 0072958863 2
0471694665 2 0471694665 2
Full functional dependency indicates that if A
and B are attributes of a relation, B is fully
functionally dependent on A if B is
functionally dependent on A, but not on any
proper subset of A.
Partial
CUSTOMER Dependency
• are nontrivial.
Second Normal Form
(2NF)
For a table to be in 2NF, there are two requirements
The database is in first normal form
All nonkey attributes in the table must be functionally
dependent on the entire primary key
Note: Remember that we are dealing with non-key attributes
1 McGraw-Hill
Book Table
ISBN Title Pages Publisher_ID
STUDENT
STUDENT
STUDENT COURSE
Stud_ID Name
Course_ID Units
101 Lennon
101 Lennon MSI 250 3.00
125 Johnson MSI 415 3.00
MSI 331 3.00
In this example there exists a one-to-many
relationship between the book table and the
publisher. A book has only one publisher, and
a publisher will publish many books. When
there is a one-to-many relationship, a foreign
key is placed in the Book Table, pointing to
the primary key of the Publisher Table.
The other requirement for Second Normal
Form is that there cannot be any data in a
table with a composite key that does not
relate to all portions of the composite key.
Third normal form (3NF) requires that
there are no functional dependencies of
non-key attributes on something other
than a candidate key.
A table is in 3NF if all of the non-primary
key attributes are mutually independent
There should not be transitive
dependencies
Goal: Get rid of transitive dependencies.
Transitive
Dependency
EMPLOYEE
EMPLOYEE
EMPLOYEE
DEPARTMENT
De pt_ID De pt_Name
1 Acct
2 Mktg
The functional dependencies for the Client, Rental and
PropertyOwner relations are as follows:
Client
fd2 clientNo cName
(Primary Key)
Rental
fd1 clientNo, propertyNo rentStart, rentFinish (Primary Key)
fd5 clientNo, rentStart propertyNo, rentFinish (Candidate
key)
fd6 propertyNo, rentStart clientNo, rentFinish (Candidate
key)
PropertyOwner
fd3 propertyNo pAddress, rent, ownerNo, oName
(Primary Key)
fd4 ownerNo oName (Transitive
The resulting 3NF relations have the forms:
PropertyOwner Owner
propertyNo pAddress rent ownerNo ownerNo oName
Interview
ClientNo interviewDate interviewTime staffNo
CR76 13-May-02 10.30 SG5
CR76 13-May-02 12.00 SG5
CR74 13-May-02 12.00 SG37
CR56 1-Jul-02 10.30 SG5
StaffRoom
staffNo interviewDate roomNo
SG5 13-May-02 G101
SG37 13-May-02 G102
SG5 1-Jul-02 G102
Join dependency
Describes a type of dependency. For example, for
a relation R with subsets of the attributes of R
denoted as A, B, …, Z, a relation R satisfies a join
dependency if, and only if, every legal value of R
is equal to the join of its projections on A, B, …,
Z.
Domain Key Normal Form
(DKNF)
The relation is in DKNF when there can be no
insertion or deletion anomalies in the
database.
The ClientRental relation has the following functional
dependencies:
Client
ClientNo propertyNo rentStart rentFinish
ClientNo cName Rental
CR76 John Kay CR76 PG4 1-Jul-00 31-Aug-01
CR56 Aline Stewart CR76 PG16 1-Sep-02 1-Sep-02
CR56 PG4 1-Sep-99 10-Jun-00
CR56 PG36 10-Oct-00 1-Dec-01
PropertyOwner CR56 PG16 1-Nov-02 1-Aug-03
BOOK
BOOK
BOOK
ORDER
ORDER
PART
PART