Java Reference
In-Depth Information
Table 1-9: Inventory Table in 2NF
Name
Warehouse
Description
Qty
Cost
Corn Flakes
Warehouse #2
Cereal
178
1.95
Rice Krispies
Warehouse #2
Cereal
97
1.95
Rice Krispies
Warehouse #7
Cereal
103
2.05
Oatmeal
Warehouse #7
Cereal
15
0.98
Table 1-10: Warehouse Table in 2NF
Warehouse
Address
Warehouse #2
123 Pine
Warehouse #7
24 Holly
In summary, the second normal form requires that any data that is not directly related
to the entire key should be removed and placed in a separate table or tables. These
new tables should be linked to the original table using foreign keys. In the example of
Tables 1 -9 and 1-10 , the Warehouse column is both part of the primary key of Table
1-9 , and the foreign key pointing to Table 1 -10 .
Third normal form
The requirements of the third normal form are as follows:
 
The table must be in second normal form.
 
The table cannot contain fields that are not related to the primary key.
Third normal form is very similar to second normal form, with the exception that it
covers situations involving simple keys rather than compound keys. In the example
used to explain the second normal form, a compound key was used because
inventory items of the same type, such as Rice Krispies, could have different
attributes such as Warehouse number. If you are tracking unique items, such as
employees, you can have a similar situation, but with a simple key, as shown in Table
1-11 :
Table 1-11: Employee Table
Name
Department
Location
Jones
Sales
43 Elm
Smith
Production
17 Main
Williams
Shipping
123 Pine
 
Search WWH ::




Custom Search