Normal Forms

1NF :
      A table is in 1NF if all the attributes in it are atomic. There should not be any multivalued attribute. For example Consider the following scenario

EID Mobile No.
1      8438145610,9494949492
2      8484848484
3      3939393993,3434344343

In this case 1 and 3 have multiple values for Mobile No. attribute. We should eliminate them by create separate columns for each mobile number. If every attribute has only one value, then the table is in 1 NF.

2NF :
       A table is in 2 NF if the following conditions are met
       a) A table is already in 1NF and
       b) For all X->A there should not be a "Partial Dependency"

What is Partial Dependency ?
     
         For all X->A  => X is a proper subset of candidate keys and A is non-prime attribute.


What is a non-prime attribute ?
  
       Any attribute that is not part of candidate keys are called non-prime attribute.


Example 
      Consider the following functional dependency.
    
      A->B
      C->D        

Candidate Key(s) = AC

So non-prime attributes are B and D.

If you check for 2NF in the above FD's then A->B and C->D violates 2NF property, because both exhibit partial dependency property.


3NF :
       A table is in 3 NF if the following conditions are met.
       a) Table is already in 2NF.
       b) For all X->A => X is a super key or A is a prime attribute.

Example 
      Consider the following functional dependency.
    
      A->B
      B->C       

Candidate Key(s) = A.

So non-prime attributes are B and C. Prime attribute is A.

B->C doesn't satisfy the condition for 3NF. So the above FD's violate 3NF.

BCNF :(strict version of 3NF)
      A table is in 3 NF if the following conditions are met.
       a) Table is already in 2NF.
       b) For all X->A => X is a super key.

Example 
      Consider the following functional dependency.
    
      A->B
      B->C       

Candidate Key(s) = A.

So non-prime attributes are B and C. Prime attribute is A.

B->C doesn't satisfy the condition for BCNF. So the above FD's violate BCNF.

 


Comments

Popular posts from this blog

Super and Candidate Key

Canonical Cover

Anomalies In detail