normalization1
DESCRIPTION
normalization of databaseTRANSCRIPT
NORMALIZATIONOF
DATABASE
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.
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.
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.
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.
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.
I NF
2NF
3NF
4NF
5NF
DKNF
BCNF
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
Benefits
• Use storage space efficiently • Eliminate redundant data • Reduce or eliminate inconsistent
data • Ease the database maintenance
burden
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
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.
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
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
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)
SUP.NO
SUP.NAME
CITYCODE
CITY NAME
S01 NCL 01 ND
S02 EB 01 ND
S03 KBD 02 JAIPUR
SUPPLIER TABLE (1 N F)
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)
SUPPLIER TABLE (2 N F)
SUP.NO
SUP.NAME
CITYCODE
CITY NAME
S01 NCL 01 ND
S02 EB 01 ND
S03 KBD 02 JAIPUR
ITEM TABLE (2 N F)
ITEMNO
ITEMNAME
PRICE
101 KBD 110
102 MOUSE 50
103 PLUG 25
103 PLUG 25
104 CPU 5000
ORDER TABLE (2 N F)
SUP.NO
ITEMNO
QTYORD
S01 101 100
S01 102 100
S01 103 200
S02 103 100
S03 104 5000
SUP.NO
SUP.NAME
CITYCODE
S01 NCL 01
S02 EB 01
S03 KBD 02
SUPPLIER1 TABLE ( 3 N F )
CITY TABLE (3 N F )
CITYCODE
CITY NAME
01 ND
02 JAIPUR
SUPPLIER2 TABLE (4 N F )
SUP.NO
SUP.NAME
S01 NCL
S02 EB
S03 KBD
CITY1 TABLE (4 N F)
SUP.NO
CITYCODE
S01 01
S02 01
S03 02