CIS282
Normalizing a database
   Process of organizing data in database
      Avoid duplicate values
      Inconsistent dependencies
   Each table describes one entity
   Goal is Typically 3rd Normal Form
      Each Form represents a different level
      Each subsequent form requires that previous forms
      already in place
          To be in Third Normal Form, must already be in First
           and Second Normal Form
First Normal Form
 Each row/column combination has only one value
 Eliminate repeating groups
    Instead of using a single field for all items purchased, set up item and
      quantity fields


                                                  1st Normal Form
           Not Normalized                            OrderID
           OrderID                                   CustomerID
           CustomerID                                OrderDate
           OrderDate                                 ItemID
           Items Purchased                           Quantity
                                                     ItemName
Second Normal Form
 Remove fields that are not fully dependent on the key, and place in separate
  table(s)
 ItemID is not dependent on the CustomerID and OrderID; it is dependent on
  OrderID.


      1st Normal Form
                                              2nd Normal Form
         OrderID
         CustomerID                     OrderID        OrderID
         OrderDate                      CustomerID     ItemID
         ItemID                         OrderDate      Quantity
         Quantity                                      ItemName
         ItemName
Third Normal Form
 All non-key columns are mutually independent
    ItemName depends on ItemID




                                             3rd Normal Form
      2nd Normal Form                 OrderID         OrderID
OrderID        OrderID                CustomerID      ItemID
CustomerID     ItemID                 OrderDate       Quantity
OrderDate      Quantity
               ItemName              ItemID
                                     ItemName
Normalization Summary
 A change in one field should not require change in
  another field in the table
   No calculations
 All fields help describe the key
    Each record is unique
    Each table stores information about one “thing”

Normalization

  • 1.
  • 2.
    Normalizing a database  Process of organizing data in database  Avoid duplicate values  Inconsistent dependencies  Each table describes one entity  Goal is Typically 3rd Normal Form  Each Form represents a different level  Each subsequent form requires that previous forms already in place  To be in Third Normal Form, must already be in First and Second Normal Form
  • 3.
    First Normal Form Each row/column combination has only one value  Eliminate repeating groups  Instead of using a single field for all items purchased, set up item and quantity fields 1st Normal Form Not Normalized OrderID OrderID CustomerID CustomerID OrderDate OrderDate ItemID Items Purchased Quantity ItemName
  • 4.
    Second Normal Form Remove fields that are not fully dependent on the key, and place in separate table(s)  ItemID is not dependent on the CustomerID and OrderID; it is dependent on OrderID. 1st Normal Form 2nd Normal Form OrderID CustomerID OrderID OrderID OrderDate CustomerID ItemID ItemID OrderDate Quantity Quantity ItemName ItemName
  • 5.
    Third Normal Form All non-key columns are mutually independent  ItemName depends on ItemID 3rd Normal Form 2nd Normal Form OrderID OrderID OrderID OrderID CustomerID ItemID CustomerID ItemID OrderDate Quantity OrderDate Quantity ItemName ItemID ItemName
  • 6.
    Normalization Summary  Achange in one field should not require change in another field in the table  No calculations  All fields help describe the key  Each record is unique  Each table stores information about one “thing”