Wednesday, January 9, 2008

Database Normalization

Different Normal Forms in a Relational Database

1NF says:
*Eliminate duplicate columns from the table.
*No attribute should contain multiple values(e.g. 2 or more phone numbers separated by coma under column 'Contacts').
In such case Create separate tables for each group of related data.
*User should be able to identify each row with a unique column or set of columns (the primary key).

2NF says:
*Table Should be in 1st NF
*all the non-prime attributes must have Full functional dependency on all candidate keys.
i.e. non-prime attributes depends on complete candidate keys and not on its subset.
*Place any such data to new tables and link them with the help of foreign keys.

3NF Says:
*Table Should be in 2nd NF
*It prohibits transitive functional dependencies of non-prime attributes on candidate keys.

BCNF says:
*Table should be in 3NF
*If X -> Y i.e. If Y depends on X, then X shoud be a super key (i.e. X is either a candidate key or a superset of candidate key).


4NF says
*Table should be in 3NF
*A relation is in 4NF if it has no multi-valued dependencies.


References
- Normalization on Wikipedia.org
- Normalization on about.com

namaste!

No comments: