Tuesday, 25 February 2014

Normal Forms - defined simply




Normal Forms – Basic Rules and Solutions


First Normal Form (1NF)


A relation schema R is in 1NF if and only if,
  • All the attributes of the relation are atomic (indivisible into meaningful sub parts),
  • Every attribute contains single value (per record).

How to convert un-normalized table into 1NF normalized table?


Expand the table by duplicating records for every value of multi-valued attributes (Flatten the table).

Second Normal Form (2NF)


A relation schema R is in 2NF if and only if,
  • At the first place the table is in 1NF,
  • All the non-key attributes of the table are fully functionally dependent on the Primary key of the table.

How to convert un-normalized or 1NF table into 2NF normalized table?


It can be done using decomposition. That is, by breaking Non-2NF relations into smaller tables using the Functional Dependencies derived.

Third Normal Form (3NF)


A relation schema R is in 3NF if and only if,
  • The table is in 2NF,
  • There is no Functional Dependency such that both Left Hand Side and Right Hand Side attributes of the FD are non-key attributes. In other words, no transitive dependency is allowed.

How to convert un-normalized or 2NF table into 3NF normalized table?


It can be done using decomposition. That is, by breaking Non-3NF relations into smaller tables using the Functional Dependencies derived. Especially, by creating a separate table for non-key attributes dependencies.

Boyce-Codd Normal Form (BCNF)


A relation schema R is in BCNF if an only if,
  • The table is in 3NF
  • For all the non-trivial FDs held on R, the left hand side of those non-trivial FDs must be Candidate Keys.

No comments:

Post a Comment

Simple introduction to Naive Bayes classifier

Simple introduction to Naive Bayes classifier What is Naive Bayes Classifier? A Naive Bayes classifier is a probabilistic classifier ...