Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Download
Standard view
Full view
of .
Add note
Save to My Library
Sync to mobile
Look up keyword
Like this
0Activity
×
0 of .
Results for:
No results containing your search query
P. 1
11_NormalForms-4upV2

11_NormalForms-4upV2

Ratings: (0)|Views: 15|Likes:
Published by Tobin Joseph Mali

More info:

Published by: Tobin Joseph Mali on Feb 27, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See More
See less

02/27/2013

pdf

text

original

 
1
Normal Forms — 1CSC343 – Introduction to Databases 
Week 11: Normal Forms
Database DesignDatabase Redundancies and AnomaliesFunctional DependenciesEntailment, Closure and EquivalenceLossless DecompositionsThe Third Normal Form (3NF)The Boyce-Codd Normal Form (BCNF)Normal Forms and Database Design
Normal Forms — 2 CSC343 – Introduction to Databases 
Logical Database Design
We have seen how to design a relationalschema by first designing an ER schemaand then transforming it into a relationalone.
Now we focus on how to transform thegenerated relational schema into a "better"one.
Goodness of relational schemas is definedin terms of the notion of 
normal form
.
Normal Forms — 3 CSC343 – Introduction to Databases 
Normal Forms and Normalization
A
normal form
is a property of a database schema.
When a database schema is un-normalized (that is,does not satisfy the normal form), it allowsredundancies of various types which can lead toanomalies and inconsistencies.
Normal forms can serve as basis for evaluating thequality of a database schema and constitutes a usefultool for database design.
Normalization
is a procedure that transforms an un-normalized schema into a normalized one.
Normal Forms — 4 CSC343 – Introduction to Databases 
Examples of Redundancy
Employee Salary Project Budget Function
Brown 20 Mars 2 technicianGreen 35 Jupiter 15 designeGreen 35 Venus 15 designeHoskins 55 Venus 15 manageHoskins 55 Jupiter 15 consultantHoskins 55 Mars 2 consultantMoore 48 Mars 2 manageMoore 48 Venus 15 designeKemp 48 Venus 15 designeKemp 48 Jupiter 15 manage
 
2
Normal Forms — 5 CSC343 – Introduction to Databases 
Anomalies
The value of the salary of an employee is repeatedin every tuple where the employee is mentioned,leading to a
redundancy 
. Redundancies lead toanomalies:
If salary of an employee changes, we have tomodify the value in all corresponding tuples(
update anomaly 
)
If an employee ceases to work in projects, butstays with company, all corresponding tuples aredeleted, leading to loss of information (
deletionanomaly 
)
A new employee cannot be inserted in therelation until the employee is assigned to aproject (
insertion anomaly 
)
Normal Forms — 6 CSC343 – Introduction to Databases 
What’s Wrong???
We are using a single relation to represent data of very different types.
In particular, we are using a single relation to storethe following types of entities, relationships andattributes:
Employees and their salaries;
Projects and their budgets;
Participation of employees in projects, along withtheir functions.
To set the problem on a formal footing, we introducethe notion of 
functional dependency (FD)
.
Normal Forms — 7 CSC343 – Introduction to Databases 
Functional Dependencies (FDs)in the Example
Each employee has a unique salary. Werepresent this dependency as
Employee
 
 
Salary
and say "
Salary
 
functionally depends
on
Employee
"
.
Meaning: if two tuples have the same
Employee
attribute value, they must alsohave the same
Salary
attribute value
Likewise,
Project
 
 
Budget
i.e., each project has a unique budget
Normal Forms — 8 CSC343 – Introduction to Databases 
Functional Dependencies
Given schema
R(X)
and non-empty subsets
Y
 
and
Z
of the attributes
X
, we say that there is a
functional dependency 
between
Y
and
Z
 
(
Y
Z
), iff for everyrelation instance
r
of 
R(X)
and every pair of tuples
t
1
,
t
2
of 
 
r
,
if 
t
1
.Y
 
= t
2
.Y
, then
t
1
.Z = t
2
.Z
.
A functional dependency is a statement about
all allowable relations
for a given schema.
Functional dependencies have to be identified byunderstanding the semantics of the application.
Given a particular relation
r
0
of 
R(X
),
we can tell if adependency holds or not; but just because it holds for
r
0
, doesn’t mean that it also holds for
R(X)
!
 
3
Normal Forms — 9 CSC343 – Introduction to Databases 
Looking for FDs
Employee Salary Project Budget Function
Brown 20 Mars 2 technicianGreen 35 Jupiter 15 designeGreen 35 Venus 15 designeHoskins 55 Venus 15 manageHoskins 55 Jupiter 15 consultantHoskins 55 Mars 2 consultantMoore 48 Mars 2 manageMoore 48 Venus 15 designeKemp 48 Venus 15 designeKemp 48 Jupiter 15 manage
 
Normal Forms — 10 CSC343 – Introduction to Databases 
Non-Trivial Dependencies
A functional dependency
 
Y
Z
is
non-trivial 
if noattribute in
Z
appears among attributes of 
Y
, e.g.,
Employee
 
 
Salary
is non-trivial;
Employee,Project
 
 
Project
is trivial.
Anomalies arise precisely for the attributes which areinvolved in (non-trivial) functional dependencies:
Employee
 
 
Salary
;
Project
 
 
Budget
.
Moreover, note that our example includes anotherfunctional dependency:
Employee,Project
 
 
Function
.
Normal Forms — 11CSC343 – Introduction to Databases 
Dependencies Cause Anomalies,...Sometimes!
The first two dependencies cause undesirableredundancies and anomalies.
The third dependency, however, does notcause redundancies because{
Employee,Project
} constitutes a key of therelation (...and a relation cannot contain twotuples with the same values for the keyattributes.)
Dependencies on keys are OK,other dependencies are not!
 
Normal Forms — 12 CSC343 – Introduction to Databases 
Another Example
ER Model Relational Model 
 
 SI# Name Address Hobbies
1111 Joe 123 Main {biking, hiking}
SI# Name Address Hobby
1111 Joe 123 Main biking1111 Joe 123 Main hiking…………….
Redundancy 
(0.N)
This is NOT a relation

You're Reading a Free Preview

Download
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->