Академический Документы
Профессиональный Документы
Культура Документы
Objectives
After completing this chapter, you will be able to:
Refining a database
Defining Normal Form
Normalization
Normalization is a step-by-step decomposition of complex records into simple records. It results in the formation of
Normalization reduces redundancy using the principle of nonloss decomposition. A fully normalized record consists of: A primary key that identifies an entity
Why Normalization?
Does the design ensure that all database operations will be efficiently performed and that the design does not make the DBMS perform expensive consistency checks which could be avoided? Is the information unnecessarily replicated?
Unless these issues are properly handled, several difficulties like redundancy and loss of information may arise. There are several methods to avoid the above mentioned problems. One such method is database decomposition through normalization.
Insert Update
Delete
Wastage of storage. Main refinement technique: decomposition (replacing ABCD with, say, AB and BCD, or ACD and ABD).
lot
budget
Employee
Works_in
Department
Refining continued...
After
dname since did budget lot Employee
name
ssn
Works_in
Department
Normal Forms
Forms are designed to logically address potential problems in referring to and working with information stored in a
database.
A database is said to be in one of the Normal Forms, if it satisfies the rules required by that Form.
attribute.
By definition, any relational table must be in 1NF.
Full Dependency
An FD X Y is a full functional dependency if removal of any attribute A from X means that the dependency does not hold any more.
Partial Dependency
A FD X Y is a partial dependency if there is some attribute A X that can be removed from X and the dependency will still hold.
R W 5 7 8 10
It is in 1NF
Every non-prime attribute A in R is fully functionally dependent on the primary key of R. 2NF prohibits partial dependencies. If a relation is not in 2NF, it can be further normalized into a number of 2NF relations.
Transitive Dependency
An FD X Y in a relation schema R is a transitive
dependency if: There is a set of attributes Z that is not a subset of any key of R. Both X Z and Z Y hold.
Example
Test of 2NF:
{Eno} -> {Dept}: partial dependency. Emp is in 1NF, but not in 2NF. Decomposition: Emp {Eno, Dept} Proj {Eno, ProjCode, Hours}
Example
Emp{Eno, Dept, Dept_Head} Primary key: {Eno} {Eno} -> {Dept}, {Dept} -> {Dept_Head} Test of 3NF {Eno} -> {Dept} -> {Dept_Head}: Transitive dependency. Emp is in 2NF, but not in 3NF. Decomposition: Emp {Eno, Dept} Dept {Dept, Dept_Head}
Suppose that relation R contains attributes A1... An. A decomposition of R consists of replacing R by two or more relations such that: Each new relation scheme contains a subset of
Summary
You now should be able to:
Refining a database
Defining Normal Form