Presentation on theme: " Definition Components Advantages Limitations Contents Definition Definition Normal Forms Normal Forms First Normal Form First Normal Form."— Presentation transcript:
Definition Components Advantages Limitations Contents Definition Definition Normal Forms Normal Forms First Normal Form First Normal Form Second Normal Form Second Normal Form Third Normal Form Third Normal Form
Definition It is a process of simplifying a relation in such a form that no data is lost during simplification. Simplification is based on certain conditions. The process of normalization was first developed by E.F.Codd. The basic objectives of normalization are to reduce redundancy.
Normal Forms Data can be represented in any of normal forms : first, second or third if it satisfies conditions which are as follows : 1. Data must be represented in atomic form without any group (First Normal Form). 2. There should not be any key which is not completely dependent (Second Normal Form). 3. There should not be transitive dependency (Third Normal Form).
Example Consider a database that contains information of parts supplied by some supplier. Name of city in which supplier is located along with status value of city are also stored in database. Functional dependency diagram for this database can be : P# S# Status City Qty
Example Contd.. In this database S# and P# combination is used as primary key. Qty value depends upon this combination. City in which supplier is located and status value of the city are only related with S#.
First Normal Form (1NF) S#P#QtyCityStatus S1P1100Delhi30 S1P2150Delhi30 S1P3125Delhi30 S1P4140Delhi30 S2P2280Mumbai20 S2P3160Mumbai20 S3P4120Delhi30 A relation is said to be in first normal form if data items are represented in atomic form i.e without any group data item
1NF Contd.. In above table, data items are in two dimensional tabular form without any group, therefore, data is in first normal form. This representation shows a number of limitations : 1. Insertion : If we want to insert information of supplier S4 located at Jaipur with status value 40. We can’t insert this information until that supplier supplies at least one part.
1NF Contd.. 2. Deletion : If we delete the supplier S2 we will loss the information that S2 is located in Mumbai and also that Mumbai has status value 20. 3. Updation : If we change the city of S1 from Delhi to Ambala it is required to search the whole relation otherwise inconsistency may occur. The solution of these problems can be obtained by using Second Normal Form.
Second Normal Form (2NF) A relation is said to be in second normal form if it is in first normal form and every non key attribute is fully dependent on primary key. The solution to the first normal form problems can be obtained by splitting the relation in two relations as follows : S#P#QtyCityStatus S1P1100Delhi30 S1P2150Delhi30 S1P3125Delhi30 S1P4140Delhi30 S2P2280Mumbai20 S2P3160Mumbai20 S3P4120Delhi30 S#CityStatus S1Delhi30 S2Mumbai20 S3Delhi30
2NF Contd.. The second normal form still have problems due to transitive dependency. In second relation S# determines city and city determines status, therefore, status is transitively dependent on S#. Problems of second normal form are : 1. Insertion : We can’t enter the fact that a particular city has a particular status value. e.g. we can’t enter information that particular city Jaipur has a status value 40 until some supplier is located in that city.
2NF Contd.. 2. Deletion : If we delete any record from second relation we will loss the information that a particular city has particular status value. e.g. if we delete the information of supplier S2, the information that the status of Mumbai is 20 is also lost.
2NF Contd.. 3. Updation : If we want to change the status value for Delhi from 30 to 50 the there is a problem of searching the whole second relation otherwise inconsistency will occur. These problems can be solved if we split the second relation and making the relation in Third Normal Form.
Third Normal Form (3NF) A relation is in third normal form if and only if it is in second normal form and every non key attribute is not transitively dependent on primary key. The second relation can be split into two relations which will remove the problems of second relation S#P#Qty S1P1100 S1P2150 S1P3125 S1P4140 S2P2280 S2P3160 S3P4120 S#City S1Delhi S2Mumbai S3Delhi CityStatus Delhi30 Mumbai20
3NF Contd.. Now these two relations are in third normal form. This normal form removes the insertion, deletion & updation anomalies of second normal form i.e. here, We insert the information that city Jaipur has a status value 40 even though no supplier is located in that city. We can also delete the information of supplier S2 & this deletion will not effect the status value of Mumbai. We can also modify the status of any city because changes has to occur at only one place.