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

Database Design

6-2
Normalization and First Normal Form

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


Objectives

This lesson covers the following objectives:


• Define the purpose of normalization in database models
• Define the rule of First Normal Form in the normalization
process
• Determine if an entity conforms to the rule of First Normal
Form
• Convert an entity to First Normal Form if needed

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 3
Normalization and First Normal Form
Purpose

• Think about storing your friends’ phone numbers in three


different places: your address book, your cell phone, and a
sheet of paper that you have taped to your refrigerator.
• It’s a lot of work if a friend changes his/her phone number.
• You have to change it in your address book, cell phone, and
the sheet of paper taped to your refrigerator.

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 4
Normalization and First Normal Form
Purpose

• What happens if data is stored in more than one place in a


database?
• What if someone changes the information in one place and
not the other—how do you know which information is
correct?
• Redundancy like this causes unnecessary problems in a
database.

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 5
Normalization and First Normal Form
Purpose

• Normalization is a process that is used to eliminate these


kinds of problems.
• One of your goals as a database designer is to "store
information in one place and in the best possible place“.
• If you follow the rules of normalization, you will achieve this
goal.

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 6
Normalization and First Normal Form
First Normal Form (1NF)
SCHOOL BUILDING 1NF
• First Normal Form requires SCHOOL BUILDING The classroom attribute
that no multi-valued # code will have multiple
attributes exist. * name values.
* address This entity is not in First
• To check for 1NF, validate o classroom Normal Form.

that each attribute has a


single value for each instance
of the entity. SCHOOL BUILDING the location CLASSROOM
of # number
# code
• One code, one name, and * name located * floor
one address exist for the * address
in
* size
school building, but not one
CLASSROOM is now its own entity.
classroom. All attributes have only one value per instance.
Both entities are in First Normal Form.

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 7
Normalization and First Normal Form
First Normal Form (1NF)
SCHOOL BUILDING 1NF
• Since many classrooms exist SCHOOL BUILDING The classroom attribute
in a school building, # code will have multiple
classroom is multi-valued * name values.
* address This entity is not in First
and violates 1NF. o classroom Normal Form.

• If an attribute is multi-
valued, create an additional
entity and relate it to the SCHOOL BUILDING the location CLASSROOM
original entity with a 1:M # code of # number
relationship. * name located
in
* floor
* address * size

CLASSROOM is now its own entity.


All attributes have only one value per instance.
Both entities are in First Normal Form.

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 8
Normalization and First Normal Form
1NF Violations
1) STUDENT
# number
• Examine the entities. * first name
* last name
• Are there any multi-valued * subject

attributes?
2) SHOPPING
MALL
# id
* name
* address
* store name
* store floor

3) TEAM LEAGUE
# id belong to # number
* name * name
made up of
* player

1NF Violations

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 9
Normalization and First Normal Form
1NF Solutions 1) SUBJECT STUDENT
taken by
# id # number
* name takes * first name
* last name
• When all the * subject
attributes in an entity
are single-valued, that 2) STORE
# name
located in SHOPPING
MALL
entity is said to be in * floor
house
# id
* name
First Normal Form. * address
3) TEAM * store name
# id * store floor
* name
belong to
* player
made up of LEAGUE
# number
have belong to * name

PLAYER
# number
* name 1NF Solutions
o position

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 10
Normalization and First Normal Form
Terminology

Key terms used in this lesson included:


• First Normal Form (1NF)
• Normalization
• Redundancy

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 11
Normalization and First Normal Form
Summary

In this lesson, you should have learned how to:


• Define the purpose of normalization in database models
• Define the rule of First Normal Form in the normalization
process
• Determine if an entity conforms to the rule of First Normal
Form
• Convert an entity to First Normal Form if needed

DDS6L2 Copyright © 2015, Oracle and/or its affiliates. All rights reserved. 12
Normalization and First Normal Form

You might also like