You are on page 1of 14

Steps in Normalization

First Normal Form (1NF): Elimination of multi valued attributes Example: Un normalized table Department Computer Faculty Lakshmi Anjali Class BE MBA Subject {DS, OS} {SQM, ST)

Normalized table in 1NF: Department Computer Computer Computer Computer Faculty Lakshmi Lakshmi Anjali Anjali Class BE BE MBA MBA Subject DS OS SQM ST

Second Normal Form (2NF): It is already in 1NF and it has no partial dependency. It is based on the concept of fully functional dependency

Fully functional dependency: EX: Mark 1 Together gives FD Grade Mark 2 Grade Fully

Partial Functional Dependency: SPR NO Any one gives Student Name REG No Student Name

Ex: Un normalized table Professor Professor Professor Jone Jone Smith Smith Lee Subject Office Subject Maths 1 CS 501 Chem 1 Chem 2 Maths 2 Office MH1 MH1 Che1 Che1 MH2 Not Fully FD

Normalized table in 2NF: Staff 1 Professor Jone Jone Smith Smith Lee Subject Maths 1 CS 501 Chem 1 Chem 2 Maths 2

Subject is fully functional dependent on Professor Staff 2 Professor Jone Smith Lee Office MH1 Che1 MH2

Office is fully functional dependent on Professor

Third Normal Form(3NF): It is already in 2NF and it has no transitive dependency EX:

X Dependency)

Y (No Transitive

X Z; Z (Transitive Dependency)

Ex: Un Normalized Employee Table: E_ID 100 101 300 E_ID Rate Group E_NAME Charles James Jennifer RATE GROUP A B A HRLY RATE $1000 $500 $1000 Rate Group Hourly Rate

Normalized Employee Table in 3NF: Employee 1 E_ID 100 101 300 E_NAME Charles James Jennifer RATE GROUP A B A

Employee 2 RATE GROUP A B HRLY RATE $1000 $500

Boyce Codd Normal Form (BCNF): It is already in 3NF. It should be a Non Trivial FD It deals with relation tables which has multiple candidate keys Identify all the determinants and make sure that they are candidate keys.

The right hand side is a subset of the left hand side is called Trivial functional dependency. Otherwise it is called Non trivial FD EX:

Reg No, Marks trivial Reg No, Marks

Grade Marks

Non Trivial

Ex:Un Normalized Table Client Interview Client No Interview Date CR76 13-June-2011 CR56 13-June-2011 CR74 13-June-2011 CR56 01-July-2011 Example of BCNF: Fd1: Client No, Interview Date Interview Time, Staff No, Room No Interview Time 10.30 12.00 12.00 10.30 Staff No SG5 SG5 SG3 SG5 Room No G101 G101 G102 G102

Fd2: No

Staff No, Interview Date, Interview Time Clien

Candidate Key

Fd3:

Room No. Interview Date, Interview Time

Candidate Key

Fd4:

Staff No, Interview Date

Ro

Not a Candidate Key

Normalized Table:

Interview Client No CR76 CR56 CR74 CR56 Interview Date 13-June-2011 13-June-2011 13-June-2011 01-July-2011 Interview Time 10.30 12.00 12.00 10.30 Staff No SG5 SG5 SG3 SG5

Staff Room Staff No SG5 SG3 SG5 Interview Date 13-June-2011 13-June-2011 01-July-2011 Room No G101 G102 G102

Now all the determinants are Candidate Keys

Fourth Normal Form (4NF): It is already in BCNF It contains no non trivial multi valued dependencies MVD represents a dependency between attributes(A,B,C) in a relation, such that for each value of there is a set of values for B and a set of values for C. However the set of values for B and C are independent of each other

MVD is represented as A >> B

A EX:

>>

Un Normalized Branch Staff Owner Table

Branch No B003 B003 B003 B003

SName Ann Beech David Ford Ann Beech David Ford

OName Carl Farrel Carl Farrel Tina Murphy Tina Murphy

The table should not contain 2 or more one to many or many to many relationships. Decompose into 2 tables. Normalized Table:

Branch Staff Branch No B003 B003 SName Ann Beech David Ford Branch Owner

Branch No B003 B003

OName Carl Farrel Tina Murphy

Join Dependencies and Fifth normal form (5NF): It is already in 4NF It has no join dependency Decomposition: The normalization procedure involves breaking down or decomposing of given data into several tables that will be connected to each other based on the data within them and moreover that the decomposition is required to be reversible, so that no information is lost in the process

Types of decomposition: 1. Lossless decomposition 2. Lossy decomposition Relation R

Model 1 2 3

Price 100 200 300

Category A B A

Lossless decomposition Decomposing the table R into 2 tables R1 and R2 R1 Model 1 2 3 R2 Model 1 2 3 Category A B A R2 Category A B Price 100 200 300

Resultant relation after join = R1 Model 1 2 Price 100 200

300

Lossy Decomposition: R1 Model 1 2 3 R2 Category A B A Price 100 200 300 R2 Category A A B A A Category A B A

Resultant relation after join = R1 Model 1 1 2 3 3 Price 100 300 200 100 300

Extra Records

You might also like