normalization1

24
NORMALIZATION OF DATABASE

Upload: spark123

Post on 11-Apr-2015

125 views

Category:

Documents


3 download

DESCRIPTION

normalization of database

TRANSCRIPT

Page 1: NORMALIZATION1

NORMALIZATIONOF

DATABASE

Page 2: NORMALIZATION1

The Need

• Illogically or inconsistently stored data can cause a number of problems.

• In a relational database, a logical and efficient design is just as critical.

• A poorly designed database may provide erroneous information, may be difficult to use, or may even fail to work properly.

Page 3: NORMALIZATION1

Definition

• The process of designing a relational database includes making sure that a table contains only data directly related to the primary key, that each data field contains only one item of data, and that redundant (duplicated and unnecessary) data is eliminated.

• The task of a database designer is to structure the data in a way that eliminates unnecessary duplication(s) and provides a rapid search path to all necessary information.

• This process of specifying and defining tables, keys, columns, and relationships in order to create an efficient database is called normalization.

Page 4: NORMALIZATION1

Normalization is part of successful database design.

Without normalization, database systems can be

inaccurate, slow, and inefficient and they might not produce the data

you expect.

Page 5: NORMALIZATION1

Un-Normal Form

• The database is said to be in an un-normal form if there are repeating group-of items in a data file.

Page 6: NORMALIZATION1

Normal Forms

• We use the normalization process to design efficient and functional databases. By normalizing, we store data where it logically and uniquely belongs. The normalization process involves a few steps and each step is called a form.

Page 7: NORMALIZATION1

I NF

2NF

3NF

4NF

5NF

DKNF

BCNF

Page 8: NORMALIZATION1

Goals

• Arranging data into logical groups such that each group describes a small part of the whole

• Minimizing the amount of duplicated data stored in a database

• Building a database in which you can access and manipulate the data quickly and efficiently without compromising the integrity of the data storage

• Organizing the data such that, when you modify it, you make the changes in only one place

Page 9: NORMALIZATION1

Benefits

• Use storage space efficiently • Eliminate redundant data • Reduce or eliminate inconsistent

data • Ease the database maintenance

burden

Page 10: NORMALIZATION1

1 N F

• The relation is said to be in first normal form, if and only if all the fields in a record are single value.

• There should not be any repeating groups of items

Page 11: NORMALIZATION1

2 N F

• A relation is said to be in second normal form if and only if it is in first normal form and every non key field completely depends on either the candidate keys (primary key/alternate key) or the concatenated key.

Page 12: NORMALIZATION1

3 N F

• A relation is said to be in third normal form, if no non key field depends on another non-key field.

• This form further divides 2NF table into two more tables. So there are total 4 tables

Page 13: NORMALIZATION1

4 N F

• A relation is said to be in fourth normal form, if no key of a record type contains two or more data items which are independent and multi-valued

• 4NF divides a 3NF table into 2 more tables. So there are 5 tables in all

Page 14: NORMALIZATION1

SUP.NO

SUP.NAME

CITYCODE

CITY NAME

ITEMNO

ITEMNAME

QTYORD

PRICE

S01 NCL 01 ND 101 KBD 100 110

S01 NCL 01 ND 102 MOUSE 100 50

S01 NCL 01 ND 103 PLUG 200 25

S02 EB 02 JAIPUR 103 PLUG 100 25

S03 KBD 02 JAIPUR 104 CPU 50 5000

SUPPLIER-ORDER TABLE

(Un-normal form)

Page 15: NORMALIZATION1

SUP.NO

SUP.NAME

CITYCODE

CITY NAME

S01 NCL 01 ND

S02 EB 01 ND

S03 KBD 02 JAIPUR

SUPPLIER TABLE (1 N F)

Page 16: NORMALIZATION1

SUP.NO

ITEMNO

ITEMNAME

QTYORD

PRICE

S01 101 KBD 100 110

S01 102 MOUSE 100 50

S01 103 PLUG 200 25

S02 103 PLUG 100 25

S03 104 CPU 50 5000

ITEM-ORDER TABLE (1 N F)

Page 17: NORMALIZATION1

SUPPLIER TABLE (2 N F)

SUP.NO

SUP.NAME

CITYCODE

CITY NAME

S01 NCL 01 ND

S02 EB 01 ND

S03 KBD 02 JAIPUR

Page 18: NORMALIZATION1

ITEM TABLE (2 N F)

ITEMNO

ITEMNAME

PRICE

101 KBD 110

102 MOUSE 50

103 PLUG 25

103 PLUG 25

104 CPU 5000

Page 19: NORMALIZATION1

ORDER TABLE (2 N F)

SUP.NO

ITEMNO

QTYORD

S01 101 100

S01 102 100

S01 103 200

S02 103 100

S03 104 5000

Page 20: NORMALIZATION1

SUP.NO

SUP.NAME

CITYCODE

S01 NCL 01

S02 EB 01

S03 KBD 02

SUPPLIER1 TABLE ( 3 N F )

Page 21: NORMALIZATION1

CITY TABLE (3 N F )

CITYCODE

CITY NAME

01 ND

02 JAIPUR

Page 22: NORMALIZATION1

SUPPLIER2 TABLE (4 N F )

SUP.NO

SUP.NAME

S01 NCL

S02 EB

S03 KBD

Page 23: NORMALIZATION1

CITY1 TABLE (4 N F)

SUP.NO

CITYCODE

S01 01

S02 01

S03 02

Page 24: NORMALIZATION1