Normalization: Example of 1NF
Normalization: Example of 1NF
There are five levels or layers of Normalization called 1st, 2nd, 3rd, BCNF, 4th, and 5th Normal
Forms. Each Normal Form is a refinement of the previous Normal Form. 4th and 5th Normal
Forms are rarely applied.
Example of 1NF:
Consider the example of Sales order information which contains the Order and sales details of a
customer.
Initial table contains the details of SalesOrder.
SalesOrder table contains the following columns.
Order Customer City State ZIP Order Shippin Item Item Item Item Item Item
Number(P Phone Date g date quantit desc quantity price desc price
K) y 1 1 1 2 2
Sales Order
Order Customer City State ZIP Order Shipping
Number(PK) Phone Date Date
1 9859658524 Hyderabad AP 500008 1998- 1998-06-
2 06-13 20
Sales Order item
The second Normal form can be defined as the level where tables are in 1NF, and where for every
table, all its non-primary key columns are dependent on the whole primary key. A column should
not be partially dependent on the primary key.
When a column depends on part of the primary key it is called partial dependency.
To bring a table to the 2NF, any of the following rules should be met.
1. The primary key column should not be a composite key. That is, it should be made up of
only one column.
2. All the non-primary key columns are dependent only on the primary key.
3. There should be no non-primary key dependent columns in the table.
In the example the customer information does not depend on the primary key that is order
Number. So make it as a separate table.
Sales Order
Order Customer Order Date Shipping
Number(PK) Number(FK) Date
1 256 1998-06-13 1998-06-20
Customer
Customer Customer City State ZIP
Number(PK) Phone
256 985965852 Hyderabad AP 5000082
4
This is 2NF
In this Example city, state does not depend on customer number it depends on ZIP code.
To be this in 3NF should separate the city, state and ZIP from the above table.
• When a relation has more than one candidate key, anomalies may result even though the
relation is in 3NF.
• 3NF does not deal satisfactorily with the case of a relation with overlapping candidate
keys
• i.e. composite candidate keys with at least one attribute in common.
• BCNF is based on the concept of a determinant.
• A determinant is any attribute (simple or composite) on which some other attribute is
fully functionally dependent.
• A relation is in BCNF is, and only if, every determinant is a candidate key.
For each Person / Shop Type combination, the table tells us which shop of this type is
geographically nearest to the person's home. We assume for simplicity that a single shop cannot
be of more than one type.
The violation of BCNF means that the table is subject to anomalies. For example, Eagle Eye
might have its Shop Type changed to "Optometrist" on its "Fuller" record while retaining the
Shop Type "Optician" on its "Davidson" record. This would imply contradictory answers to the
question: "What is Eagle Eye's Shop Type?" Holding each shop's Shop Type only once would
seem preferable, as doing so would prevent such anomalies from occurring:
A table is said to be in the 5NF if and only if it is in 4NF and every join dependency in it is
implied by the candidate keys.
Sometimes it is impossible to break the table into 2 tables, that is when we can use the rules of
5NF to normalize.
Generally a table in 4NF is always in 5NF, but sometimes real world constraint will cause the
Relation to be not comply with 5th NF.
5th Normal Form divides related columns into separate tables based on those relationships. In
the example product, manager, and employee are all related to each other. Thus, three separate
entities can be created to explicitly define those inter-relationships. The result is information that
can be reconstructed from smaller parts. An additional purpose of 5th Normal Form is to remove
redundancy or duplication not covered by the application of 1st to 4th Normal Forms of
Normalization.
Product Employee
CCUI Sony
WSI James