Normalization-Database Design-2nd Edition
Normalization-Database Design-2nd Edition
Search in book …
CONTENTS
Main Body
Chapter 12 Normalization
ADRIENNE WA
Normalization should be part of the database design process. However, it is dif cult
to separate the normalization process from the ER modelling process so the two
techniques should be used concurrently.
Use an entity relation diagram (ERD) to provide the big picture, or macro view, of
an organization’s data requirements and operations. This is created through an
iterative process that involves identifying relevant entities, their attributes and their
relationships.
Normalization procedure focuses on characteristics of speci c entities and
represents the micro view of entities within the ERD.
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 1/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
Normal Forms
All the tables in any database can be in one of the normal forms we will discuss
next. Ideally we only want minimal redundancy for PK to FK. Everything else should
be derived from other tables. There are six normal forms, but we will only look at
the rst four, which are:
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 2/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
In the rst normal form, only single values are permitted at the intersection of each
Increase Font Size
row and column; hence, there are no repeating groups.
To normalize a relation that contains a repeating group, remove the repeating
group and form two new relations.
The PK of the new relation is a combination of the PK of the original relation plus
an attribute from the newly created relation for unique identi cation.
In the Student Grade Report table, the repeating group is the course
information. A student can take many courses.
Remove the repeating group. In this case, it’s the course information for each
student.
Identify the PK for your new table.
The PK must uniquely identify the attribute value (StudentNo and CourseNo).
After removing all the attributes related to the course and student, you are left
with the student course table (StudentCourse).
The Student table (Student) is now in rst normal form with the repeating
group removed.
The two new tables are shown below.
Student
Previous: (StudentNo,
Chapter 11 Functional StudentName,
Dependencies Major)
Next: Chapter 13 Database Development Process
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 3/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
For the second normal form, the relation must rst be in 1NF. The relation is
automatically in 2NF if, and only if, the PK comprises a single attribute.
If the relation has a composite PK, then each non-key attribute must be fully
dependent on the entire PK and not on a subset of the PK (i.e., there must be no
partial dependency or augmentation).
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 4/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
When examining the Student Course table, we see that not all the attributes
Increase are
Font Size
fully dependent on the PK; speci cally, all course information. The only
attribute that is fully dependent is grade.
Identify the new table that contains the course information.
Identify the PK for the new table.
The three new tables are shown below.
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 5/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
To be in third normal form, the relation must be in second normal form. Also
Increase all Size
Font
transitive dependencies must be removed; a non-key attribute may not be
functionally dependent on another non-key attribute.
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 6/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
At this stage, there should be no anomalies in third normal form. Let’s look Font
Increase at the
Size
dependency diagram (Figure 12.1) for this example. The rst step is to remove
repeating groups, as discussed above.
Student (StudentNo, StudentName, Major)
StudentCourse (StudentNo, CourseNo, CourseName, InstructorNo,
InstructorName, InstructorLocation, Grade)
To recap the normalization process for the School database, review the
dependencies shown in Figure 12.1.
When a table has more than one candidate key, anomalies may result even though
the relation is in 3NF. Boyce-Codd normal form is a special case of 3NF. A relation is
in BCNF if, and only if, every determinant is a candidate key.
BCNF Example 1
Previous: Chapter 11 Functional Dependencies
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 7/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
The semantic rules (business rules applied to the database) for this table are:
The functional dependencies for this table are listed below. The rst one is a
candidate key; the second is not.
1.Previous:
St_Adv Chapter 11 Functional Dependencies
(Student_id, Advisor)
2. Adv_Maj (Advisor, Major) Next: Chapter 13 Database Development Process
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 8/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
Student_id Advisor
111 Smith
111 Chan
320 Dobbs
671 White
803 Smith
Adv_Maj table
Advisor Major
Smith Physics
Chan Music
Dobbs Math
White Physics
BCNF Example 2
A relation is in BCNF if, and only if, every determinant is a candidate key. Font
Increase We need
Size
to create a table that incorporates the rst three FDs (Client_Interview2 table) and
another table (StaffRoom table) for the fourth FD.
Client_Interview2 table
StaffRoom table
During the normalization process of database design, make sure that proposed
entities meet required normal form before table structures are created. Many real-
world databases have been improperly designed or burdened with anomalies if
improperly modi ed during the course of time. You may be asked to redesign and
modify existing databases. This can be a large undertaking if the tables are not
properly normalized.
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 10/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
Exercises
1. What is normalization?
2. When is a table in 1NF?
3. When is a table in 2NF?
4. When is a table in 3NF?
5. Identify and discuss each of the indicated dependencies in the
dependency diagram shown in Figure 12.2.
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 11/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
7. Using the dependency diagram you just drew, show the tables (in their
third normal form) you would create to x the problems you
encountered. Draw the dependency diagram for the xed table.
8. An agency called Instant Cover supplies part-time/temporary staff to
hotels in Scotland. Figure 12.4 lists the time spent by agency staff
working at various hotels. The national insurance number (NIN) is
unique for every member of staff. Use Figure 12.4 to answer questions
(a) and (b).
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 12/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
Bibliography
Nguyen Kim Anh, Relational Design Theory. OpenStax CNX. 8 Jul 2009 Retrieved July
2014 from http://cnx.org/contents/606cc532-0b1d-419d-a0ec-ac4e2e2d533b@1@1
Russell, Gordon. Chapter 4 – Normalisation. Database eLearning. N.d. Retrived July
2014 from db.grussell.org/ch4.html
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 13/14
8/7/2019 Chapter 12 Normalization – Database Design – 2nd Edition
https://opentextbc.ca/dbdesign01/chapter/chapter-12-normalization/ 14/14