An Idea can change your life.....

Thursday, October 29, 2009

Rules of Data Normalization - 2NF


2NF was originally defined by E.F. Codd[1] in 1971. A table that is in first normal form (1NF) must meet additional criteria if it is to qualify for second normal form. Specifically: a 1NF table is in 2NF if and only if, given any candidate key and any attribute that is not a constituent of a candidate key, the non-key attribute depends upon the whole of the candidate key rather than just a part of it.



Rule2.gif (8304 bytes)






Definition: In order to be in Second Normal Form, a relation must first fulfill the requirements to be in First Normal Form. Additionally, each nonkey attribute in the relation must be functionally dependent upon the primary key. : In order to be in Second Normal Form, a relation must first fulfill the requirements to be in First Normal Form. Additionally, each nonkey attribute in the relation must be functionally dependent upon the primary key.


database design A series of steps followed to obtain a database design that allows for efficient access and storage of data in a relational database. These steps reduce data redundancy and the chances of data becoming inconsistent.



A table in a relational database is said to be in normal form if it satisfies certain constraints. Codd's original work defined three such forms but there are now five generally accepted steps of normalisation.
 
The most obvious indication that a database is not 2NF is if multiple records in a table might have the exact same value for a column.
 
To make a database 2NF compliant:
  • Identify any fields that do not relate directly to the primary key.
  • Create new tables accordingly
  • Assign or create new primary keys
  • Create the requisite foreign keys indicating the relationships
Note that when a 1NF table has no composite candidate keys (candidate keys consisting of more than one attribute), the table is automatically in 2NF.

No comments: