Monday, April 20, 2009

Database Normalization

Normalization is a data modeling technique, the goal of which is to organize data elements in such a way that they’re stored in one place and one place only (with the exception of foreign keys, which are shared).

Universal properties
No duplicate members of the set.
Record order unimportant (top to bottom).
Attributes order unimportant (left to right).
All attribute values are atomic. No single attribute is allowed to hold more than one value at one time.

First Normal Form (1NF)
The appropriateness of the primary key.
Note: 1NF demands that every member of the set depends on the key, and no repeating groups are allowed.
(Car 1,2,3:Serial Number, Color Names, Make Name…) in one table; extract then to “Car Order” table

Second Normal Form (2NF)
The dependence of all attributes on all aspects of the primary key.
Note: 2NF demands that every aspect of every member of the set depends on the whole key.
In “Car Order” table (Order Number (FK), Car Serial Number, Car Color Name, Car Make Name etc.) it should be identified by one primary key.

Third Normal Form (3NF)
The dependence of any attribute on any attribute other than the primary key.
Note: 3NF demands that every data element of every member of the set depends on nothing but the key.
(Look at the Car data set. Can a Car Model Name of Camry have a Car Make Name of GM? No, only Toyota makes Camry. Can a Camry have a Car Year Number of 1975? No, the Toyota Camry wasn’t offered until 1983. Dependencies exist between the values of Make, Model, and Year of a Car. These dependencies create a set of true facts about cars that can be used repeatedly by many different members of the set of cars.)

Boyce-Codd Normal Form (BCNF)
Verifies that all data sets are identified and segregated.
Note: BCNF demands that every data element must be a fact about the data set whose members are identified by the key and that all keys are identified.

Fourth Normal Form (4NF)
Verifies that all attributes are single valued for a member of the set.

Fifth Normal Form (5NF)
Verifies that if the constituent parts of a data set were divided, they couldn’t be reconstructed.

Domain Key Normal Form (DKNF)
Verifies that all constraints are the logical consequence of the definition of the keys and the domains (data value rules).

Denormalization
Denormalization is performed after weighing the benefit it will bring to your application’s performance against a loss of relational integrity and ease of data value management.

No comments:

Post a Comment