Thursday, August 29, 2013

DW - Normalization Details

Unnormalized Relation
------------------------------------------------------------------------------------------------------------
Order no.             Order date                  Item lines
------------------------------------------------------------------------------------------------------------
                                                              Item code            Quantity           Price/Unit

1                           1/1/2001                   100                        1                     100
                                                              200                        2                     50                            

                                                               Item code            Quantity           Price/Unit

2                        2/1/2001                       100                       5                    100


First Normal Form(1NF) [Flat File] - there is no composite attributes, and every attribute is single & describes 1 property.
------------------------------------------------------------------------------------------------------------
Order no.             Order date              Item code            Quantity           Price/Unit
------------------------------------------------------------------------------------------------------------
1                           1/1/2001                   100                        1                     100
1                           1/1/2001                   200                        2                     50
2                           2/1/2001                   100                        5                    100

2NF:if it is in 1NF and non-key attributes are functionally dependant on the key attribute(s).
Orders:                                           Order Details:  
--------------------------------
Order no.             Order date
--------------------------------
Order Details:
----------------------------------------------
Order no.             Item code            Quantity
----------------------------------------------
Prices:
----------------------------------------------
 Item code            Price/Unit
----------------------------------------------
3NF:where all attributes in a relation are not functionally dependent only on the key. If 2 non-key attributes
are functionally dependent.
2NF:

Stud_id      Name         Department     Year  Hostel name
1                A               Physics               1       xyz
2                B                Math                  3      abc

Converting 2NF: to 3NF:

Stud_id      Name         Department     Year
1                A               Physics               1    
2                B                Math                  3    

Year  Hostel name
1       xyz
2       def  
3      abc

Reference book:Analysis & Design of Information Systems By:V.RAJARAMAN

No comments:

Post a Comment