basic sql(structured quiry language),normalization database applications

normalization 
normalization is basically used to decomposes the data when the redundancy is occur . its an primary use of the database management system.

basically 3 normal forms enough to build an data base system .

1.first normal form
2.second normal form
3.third normal form

first normal form 
the table is said to be in first normal form it satisfy s the following steps
1.table must have the atomic values that means single values.
2.primary key identified by the table.
3.all columns of the table defined on primary key 
as shown in below 

table             :    student details
primary key :    student id

student id      student name    branch 
s1                    rainy                computer science
s 2                   james               electrical
s 3                   maria               mechanical

second normal form
the table is said to be in second normal form it should satisfy the following rules
1.it should satisfy s the first normal form rules
2.it does not contain the partial dependency s  

table name      :   project details
primary key    :   project id + student id
project id         student id       student name    project name
p1                      s1                     james               e learning
p2                      s2                     john                 e books
p3                      s3                     prema              space research

the above table is not in second normal form its violets the second rule. it has partial dependency s 
that means it has two primary keys so this is not in second normal form . above table can be divided into  3 ways 

1)  table name     :   project details 
     primary key   :   project id 

project id        projcet name 
p1                    e learning
p2                    e books
p3                    space research

2)  table name      :  student details
      primary key    :  student id 

student id         student name
s1                      james
s2                      john
s3                      prema

3)  table name    :    project details
     primary key  :    student id + project id 

student id       project id     project name
s1                      p1               e learning
s2                      p2               e books    
s3                      p3               space research

all these tables are in 3rd normal form

third normal form
the table is said to be in third normal form it should satisfy the following rules

1.it satisfy the 2nd normal form
2.table does not have the transitive dependency s . that means any of  column  of the table does not depend upon the non primary key column

table name      :  project details
primary key    : student id 

student id      student name    project id    project name
s1                    stefen                 p1             water plant
s2                    shreenita            p2             snow scating
s3                    roja raman         p3             texting

above table is not in third normal form in that table  project name depending on non primary key column project id . so it is having partial dependency s . the table can be divided into different ways as shown in below .

1)    table name      :  student details
       primary key    :  student id


      student id        student name
       s1                     stefen
       s2                     shreenita      
       s3                     roja raman 

2)   table name       :    project details
      primary key     :    project id

       project id         project name
       p1                    water plant 
       p2                    snow scating
       p3                    texting

table name           :   student details
primary key         :   student id

student id     project id      student name 
s1                    p1                stefen
s2                    p2                shreenita
s3                    p3                roja raman

etc...


all these tables are in 3rd normal form....................














Comments