What is first normal form (1NF) Second normal form (2NF)

  •  First Normal Form (1NF) :-
              A relation is said to be in 1NF if it contains n0 non-atomic values and each row can Ovde a unique combination of values. The above table in UNF can be processed to create tEix tolowing tabie in 1NF .
As you can see now, each row contains unique combination of values. Unlike an not be further decomposed, so the this relation contains only atomic values, i.e. the rows can not be further decomposed relation is now in 1NF.

  • Anomalies in the 1NF :-
  1. There is redundancy in INF relation, which will lead to variety of data anomalies or inconsistencies ,
     
  2.  Insertion is very difficult.

  3.  Deletion is very difficult. Suppose, if you want to delete the record of "Jones" from the above "STUDENT" table, then three records will be deleted. So, it is very difficult to delete a record.

  4.  Updation is very difficult. Suppose, if you want to update the record of "Smith" from the above STUDENT" table, then which record is to be updated it is very difficult to decide. 
  • Second Normal Form (2NF) :-
                  A relation is said to be in 2NF if it is already in INF and each and every non-key attribure i.e. attributes which don't form primary key) fully depends on the primary key ot the relation. Speaking inversely. if a table has some attributes which are not dependents on tne primary key of that table, and then it is not in 2NF. 

 Let us explain: -

                   Student_ld is the primary key attribute of the above "STUDENT" table. Out of the onc non-key attributes (Advisor, Advisor_Room, Class ld), Advisor and Advisor_ Roo functionally dependents on the primary key attribute Student_ld. But Classu functionally dependent on Studentld, because there are multiple Class_ld values for ca Student id in the above table. So, this relation is not in second normal fom (2NF). 

                     To convert this relation into 2NF, simply split the table into two separate tadcd e for those attributes, which are dependant on the primary key attribute (Parent tabic Ceate for nd those attributes, which Create are not dependant on the primary kev (Child tadie relationships between these new tabBes through the use of foreign key .

  • Third Normal Form (3NF) :-  
    A relation is said to be in 3NF, if it is already in 2NF and there exists no transitive endency in that relation. In 3NF, remove all the non-key attributes from the relation, shich depends upon other non-key attribute in the same relation. In the above "STUDENT" ible. a non-key attribute Advisor_ Room is functionally dependent on the other non-key atribute Advisor. The solution is to move that attribute from the "STUDENT" table to the FACULTY" table, as shown below: 
What is a Transitive Dependency?
 For Example:- 

  1. If A>B [B depends on A]

  2. B>C |depends on B|
    Then we may derive

  3.  A>C ( C depends on A)
  • Boyce-Codd Normal Form (BCNF) :-
                   A relation is in Boyce-Codd Normal Form (BCNF) if it is already in 3NF and even determinant is a candidate key. Here, determinant is a simple attribute or composite attribute which can uniquely determines the value of other attribute(s).  

  • Fourth Normal Form (4NF) :-
         A Relation R is in Fourth normal form (4NF) if it is in BCNF (or 3NF) and has no multi- valued dependency or there are multi value dependencies but the attributes, which are multi value dependent on a specific attribute, are dependent between themselves.

             In this case, relation R will be in the fourth normal form (4NF) if attributes B and C are dependent on each other. However if attributes B and C are independent of each other then relation R is not in the fourth normal form (4NF).

In the above EMP table.

  1.  The attribute Department is multi-valued dependent on attribute Name.
                                Name >>Department

  2.  The attribute Language is multi-valued dependent on attribute Name.
                                 Name>>Language
 So, to convert the above relation (table) EMP with multi-valued dependencies fme move each multi-valued dependency pair to a new table which is as shown below: 
  • Fifth Normal Form (5NF) :-
                        A relation R is in Fifth normal form (5NF) if it is already in 4NF and has no o dependency i.e. a relation cannot be decomposed any further. This normal form is also Kno as Project-join normal form (PJNF). It states that any fact should be able to be reconstracic without any anomalous results in any case, regardless of the number of tables being jo SNF table should have only candidate keys and its primary key should consist of onlyas ingie column.

  • Advantages of Normalization :-

  1. Normalization prevents data redundaney in the database and reduces s ensures that each piece of data is stored only once. 

  2. It helps in maintaining data .

  3. A better handle on database security.

  4. Increased storage efficiency .

  5. Morc efficient and flexible data structure to organize the data records.

  6. Better understanding of data.
  • Disadvantages of Normalization :- 
  1. Normalizing a database is a complex and difficult task. Large databases with considerable amounts of information require careful analysis and design before they are normalized. .

  2. Requires more joins of tables to get the desired result. A poorly-written query can bring the database down. .

  3. Maintenance overhead. The higher the level of normalization, the greater the number /of tables in the database. 
Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.