Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

Database Design

6-4
Third Normal Form

Copyright © 2017, Oracle and/or its affiliates. All rights reserved.


Objectives

This lesson covers the following objectives:


• Identify transitive dependencies in a data model
• Define the rule of Third Normal Form in the normalization
process
• Examine a non-normalized entity and determine which rule,
or rules of normalization are being violated
• Apply the rule of Third Normal Form to resolve a violation in
the model

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 3
Third Normal Form
Purpose

• Your goal as a database designer is to "store information in


one place only and in the best possible place."
• Following the rules of normalization helps you achieve this
goal.
• You may want to enter different kinds of information for a
friend in your personal address book: phone number,
address, name of school or place of work.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 4
Third Normal Form
Purpose

• If you have several friends who go to the same school, and


you enter the school’s street address along with each of
them, you would not only be duplicating data but causing
potential problems - for instance, if the school moved and
changed its address, you would have to go back and change it
everywhere!
• Normalization is a process to eliminate these kinds of
problems.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 5
Third Normal Form
Third Normal Form Rule

• The rule of Third Normal Form (3NF)


states that no non-UID attribute can
be dependent on another non-UID CD
attribute. # id
* title
Third Normal
• Third Normal Form prohibits transitive Form Violation
* producer
* year
dependencies. o store name
o store address
• A transitive dependency exists when
any attribute in an entity is dependent
on any other non-UID attribute in that
entity.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 6
Third Normal Form
Third Normal Form Rule

• Think of the kind of information you'd


like to store about your CD collection.
CD
• Does information about the store # id
where you bought the CD belong in Third Normal
* title
the same entity? Form Violation
* producer
* year
• If the store address changed, you o store name
o store address
would have to change the information
on all the CDs that were bought at that
store.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 7
Third Normal Form
Third Normal Form Transitive Dependency
CD
• The store address is dependent # id
on the CD number, which is the Third Normal
* title
* producer
UID of the CD entity. So this Form Violation
* year
entity is in 1NF and 2NF. o store name
o store address
• But store address is also
dependent on store name,
which is a non-UID attribute. CD contained STORE
# id in # number
• This is an example of a transitive * title contains * name
* producer * address
dependency and a violation of * year
Third Normal Form.
Third Normal
Form

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 8
Third Normal Form
Third Normal Form Transitive Dependency
CD
• The correctly normalized model # id
is shown here: create a second Third Normal
* title
* producer
entity STORE, with a Form Violation
* year
relationship to CD. o store name
o store address

CD contained STORE
# id in # number
* title contains * name
* producer * address
* year

Third Normal
Form

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 9
Third Normal Form
Third Normal Form Example

• Consider a system that tracks


CITY
information about cities - size, # id
population, mayor, and so on. Third Normal * name
Form Violation * size
• The first model shows an entity that * population
includes state information. * mayor
* state
• Although state is an attribute of city, * state flower
state flower is really an attribute of
state.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 10
Third Normal Form
Third Normal Form Example

• The second model, with a new entity


CITY
STATE, is in Third Normal Form. # id
Third Normal * name
Form Violation * size
* population
* mayor
* state
* state flower

CITY STATE
# id # id
Third Normal in
* name * name
Form * size have * flower
* population
* mayor

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 11
Third Normal Form
Third Normal Form Second Example

• In this example,
assume the following EMPLOYEE DEPARTMENT
business rule: each # id # number
* name * name
employee can have * address
part of
* budget
one partner. * birth place composed
o partner name of
• This model violates o partner birth date
Third Normal Form
because partner birth
Third Normal
date is an attribute of Form Violation

partner, not of
EMPLOYEE.

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 12
Third Normal Form
Third Normal Form Second Example

• Another way of
stating Third EMPLOYEE DEPARTMENT
Normal Form: # id # number
* name * name
non-UID attributes * address
part of
* budget
can’t have * birth place composed
of
attributes of their o partner name
o partner birth date
own.

Third Normal
Form Violation

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 13
Third Normal Form
3NF Second Example Solution

• This model supports


EMPLOYEE DEPARTMENT
Third Normal Form # id part of # number
because partner * name * name
composed
birth date is an * address of
* budget
* birth place
attribute of partner,
not of EMPLOYEE. have

the dependent of Third Normal


Form
PARTNER
# name
* birth date

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 14
Third Normal Form
3NF Second Example Solution

• The 1:1 relationship


EMPLOYEE DEPARTMENT
is optional on the # id part of # number
EMPLOYEE end * name * name
composed
because some * address of
* budget
* birth place
employees will not
have partners. have

the dependent of Third Normal


Form
PARTNER
# name
* birth date

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 15
Third Normal Form
3NF Second Example Solution

• It is mandatory on
EMPLOYEE DEPARTMENT
the PARTNER end # id part of # number
because information * name * name
composed
about a partner is * address of
* budget
* birth place
tracked only if that
person is a partner have
of one and only one
EMPLOYEE. the dependent of Third Normal
Form
PARTNER
# name
* birth date

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 16
Third Normal Form
Terminology

Key terms used in this lesson included:


• Third Normal Form (3NF)
• Transitive dependency

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 17
Third Normal Form
Summary

In this lesson, you should have learned how to:


• Identify transitive dependencies in a data model
• Define the rule of Third Normal Form in the normalization
process
• Examine a non-normalized entity and determine which rule,
or rules of normalization are being violated
• Apply the rule of Third Normal Form to resolve a violation in
the model

DDS6L4 Copyright © 2017, Oracle and/or its affiliates. All rights reserved. 18
Third Normal Form

You might also like