Lectures / LECTURE 4
.pdfAfter the First Normal Form
The objectives of normalization beyond 1NF were stated as follows by Codd:
1.To free the collection of relations from undesirable insertion, update and deletion dependencies;
2.To reduce the need for restructuring the collection of relations, as new types of data are introduced, and thus increase the life span of application programs;
3.To make the relational model more informative to users;
4.To make the collection of relations neutral to the query statistics, where these statistics are liable to change as time goes by.
E.F. Codd, "Further Normalization of the Data Base
Relational Model"
Second Normal Form
•Relation that is in Second Normal Form (2NF) is in 1NF and has no partial dependencies on the PK.
•All non-PK attributes are fully functionally dependent on the PK.
•Second normal form is associated with modification anomalies.
Second Normal Form
•A good rule for determining if a relation is in second normal form follows:
–Suppose we have a relation with columns A, B and C.
–The PK of this relation is {A,B}.
–Also, suppose this relation had two functional dependencies:
•{A,B} -> C
•B -> C
–This relation has a partial dependency and violates 2NF.
Third Normal Form
•Third normal form is defined in terms of transitive dependencies and is associated with insertion and deletion anomalies.
•A relation is in Third Normal Form (3NF) if it is in 2NF and it contains no attributes that are transitively dependent on the Primary Key.
Normalization
•Let’s normalize two of the relations that we have looked at.
•First, the car and owner relation.
Normalization
•We said this relation contains a transitive dependency, and, thus, violates third normal form. We need to remove the transitive dependency from the table.
•We do this by breaking the relation into two tables: owners and cars.
Normalization
•Now, let’s normalize the part and order table that we looked at previously.
•Recall that the PK of this relation was {order id, part id}.
Normalization
•Also, recall that the FDs for this relation were
–FD1: {Part id, Order id} -> {part name, order name, order city}
–FD2: Part id -> Part name
–FD3: Order id -> Order name, Order city
•Because of this relation’s partial dependencies, it violates
2NF. To bring it to 2NF, we create three relations.
Summary
•Typically, a 3NF relation is considered a good database design – the normalizing process usually ends once 3NF is attained.
•So, how do we remove functional dependencies that violate a given normal form?
•We break a relation into many smaller relations while still maintaining the relationship among the data.
Summary
