Download presentation
Presentation is loading. Please wait.
Published byOsborne Stokes Modified over 9 years ago
1
Module Title? DBMS Normalization
2
Module Title? DBMS Normalization Normalization is the process of removing redundant data from tables in order to improve storage efficiency, data integrity (accuracy and consistency) and scalability (accomodates changes). This improvement is balanced against an increase in complexity and potential performance losses from the joining of the normalized tables at query-time.
3
Module Title? DBMS Steps in Normalization Normalization can be accomplished and understood in stages, each of which corresponds to a normal form. A normal form is a state of a relation that results from applying simple rules regarding functional dependencies ( or relationships between attributes) to that relation. Below are brief descriptions of the rules in normalization.
4
Module Title? DBMS Steps in Normalization First Normal Form. Any multivalued attributes (also called repeating groups) have been removed, so there is a single value (possibly null) at the intersection of each row and column of the table. Second Normal Form. Any partial functional dependencies have been removed. Third Normal Form. Any transitive dependencies have been removed.
5
Module Title? DBMS Steps in Normalization Boyce/Codd normal form. Any remaining anomalies (Deviation) that result from functional dependencies have been removed. Fourth normal form. Any multivalued dependencies have been removed. Fifth normal form. Any remaining anomalies have been removed. We describe and illustrate first through third normal forms only in this section
6
Module Title? DBMS First Normal Form A Table in which the intersection of every column and record contains one and only value Steps to Remove Repeating Groups Remove the repeating columns from the original unnormalized table. Create a new table with the primary key of the base table and the repeating columns. Add another appropriate column to the primary key, which ensures uniqueness. Create a foreign key in the new table to link back to the original unnormalized table.
7
Module Title? DBMS Table Not Satisfying 1 NF
8
Module Title? DBMS After 1 NF…….. PRIMARY KEY FOREIGN KEY PRIMARY KEY Branch Number Address B001X Street BGL B002Y Street Chennai Branch NumberTelno B001566443 B001342342 B002233444 B002456454
9
Module Title? DBMS
10
Module Title? DBMS
11
Module Title? DBMS
12
Module Title? DBMS
13
Module Title? DBMS Second Normal Form A table is in second normal form if the table is in the first normal form and every non-primary key column is functionally dependent upon the entire primary key. No non-primary key column can be functionally dependent on part of the primary key. If A and B are 2 columns, B is fully functionally dependent on A.B is not dependent on any subset of A.
14
Module Title? DBMS Second Normal Form A table in the first normal form will be in second normal form if any one of the following applies: The primary key is composed of only one column No non-keyed columns exist in the table. Every non-keyed attribute is dependent on all of the columns contained in the primary key.
15
Module Title? DBMS Second Normal Form Steps to Remove Partial Dependencies Determine which non-key columns are not dependent upon the table’s entire primary key. Remove those columns from the base table. Create a second table with those non-keyed columns and a copy of the columns from the primary key that they are dependent upon. Create a foreign key from the original base table to the new table, linking to the new primary key.
16
Module Title? DBMS Table not in 2 NF… 4AssistantAssistant SwethaSwetha X Street BglX Street Bgl B001B001 2 3AssistantAssistant AnithaAnitha Y street ChennaiY street Chennai B002B002 1 1212 AssistantAssistant SwethaSwetha Y StreetChennaiY StreetChennai B002B002 2 1616 AssistantAssistant AnithaAnitha X Street BglX Street Bgl B001B001 1 Hours per weekHours per week PositionPosition NameName Branch AddressBranch Address Branch NoBranch No Staff noStaff no Composite primary key Staff noBranch NoBranch Address NamePositionHours per week 1B001X Street BglAnithaAssistant16 2B002Y Street Chennai SwethaAssistant12 1B002Y street Chennai AnithaAssistant3 2B001X Street BglSwethaAssistant4
17
Module Title? DBMS Values in branch address can be worked out from only branch number so table not in 2 NF. Values in name and position columns can be worked out from only Staff Number so table not in 2 NF. Solution…We have to remove the fields which depend on the partial Primary key. Not in 2 NF…..
18
Module Title? DBMS Primary key After 2 NF…….. Branch NumberAddress B001X Street Bgl B002Y Street Chennai Staff Number NamePosition 1AnithaAssistant 2SwethaAssistant Branch NumberStaff NumberHours per week B001116 B002212 B00114 B00213
19
Module Title? DBMS
20
Module Title? DBMS A table is in third normal form if every non-keyed column is directly dependent on the primary key, and not dependent on another non-keyed column. If the table is in second normal form and all of the “transitive dependencies” are removed, then every non-keyed column is said to be “dependent upon the key, the whole key, and nothing but the key”. Third Normal Form
21
Module Title? DBMS Steps to Remove Transitive Dependencies Determine which columns are dependent on another non-keyed column. Remove those columns from the base table. Create a second table with those columns and the non-key columns that they are dependent upon. Create a foreign key in the original table linking to the primary key of the new table. Third Normal Form
22
Module Title? DBMS A Table not in 3 NF… ShekarShekar X002X002 645774645774 Ystreet ChennaiYstreet Chennai B002B002 SridharanSridharan X001X001 543342543342 X Street BglX Street Bgl B001B001 NameName Manager NoManager No TelnoTelno Branch AddressBranch Address Branch NumberBranch Number Primary Key Branch Number Branch Address TelnoManager No Name B001X Street Bgl543342X001Sridharan B002Ystreet Chennai 645774X002Shekar
23
Module Title? DBMS Manager name can be queried by Branch number also by Manager no. So not in 3 NF. Not in 3NF…..
24
Module Title? DBMS Solution: Converting to 3 NF. Manager NumberName X001Sridhar X002Shekar
25
Module Title? DBMS Solution: Converting to 3 NF. Branch NumberAddressTelnoManager Number B001X Street Bgl566434X001 B002Y street Chennai345667X002
26
Module Title? DBMS
27
Module Title? DBMS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.