SlideShare a Scribd company logo
Normalization - I I
      Gagan Deep
       Assistant Professor
       University College,
Kurukshetra University, Kurukshetra
                &
             Director
Rozy Computech Services, 3rd Gate,
Kurukshetra University, Kurukshetra
            Rozy Computech Services
In our previous lecture we
discussed
• Basics of Relational databases
• Objectives of Normalization
• Modification anomalies
  – Deletion Anomaly
  – Insertion Anomaly
  – Updation Anolmaly
• Functional Dependencies
• Armstrong’s axioms of FD etc.
Now we have to talk about
Normalization & Different forms of
normalization.
    Rozy Computech Services
NORMALIZATION


Normalization is
• Refinement of the database specifically ER
  model.
• Process of removing the anomalies of
  database/s
• Segregation of data over many entities or
  relations.
                 Rozy Computech Services
Need for Normalization

• Improves database design.
• Ensures minimum redundancy of data.
• To make database structure flexible
• Reduces need to reorganize data when
  design is modified or enhanced.
• To achieve consistency - Removes
  modification anomalies. Normalized model
  converted to physical database tables.
               Rozy Computech Services
Classes of Relation

• Relation can be classified by the types of
  modification anomalies to which they are
  vulnerable.
• The classes of relations and techniques for
  preventing anomalies are called normal forms.
• Depending on its structure, a relation might be
  in first normal form, second normal form, third
  normal form or some other normal form.
                  Rozy Computech Services
• E.F. Codd defined first, second, and third
  normal forms (1NF, 2NF, 3NF). Later, Boyce-
  Codd normal form (BCNF) was postulated,
  and then fourth and fifth normal forms were
  designed.
• Thus a relation that is in second form is also
  in first normal form. A relation in 5NF is also
  in 4NF, BCNF, 3NF, 2NF and 1NF.
                  Rozy Computech Services
First Normal Forms (1NF)

• Every relation is, by definition, in first normal
  form. That is because a relation, has no
  repeating groups in it - that is the
  characteristic of the first normal form.
• In easy words, only one value is associated
  with each attribute and the value is not a set
  of values or a list of values.
• Let us study with the help of example about
  this non repeating group characteristic
                  Rozy Computech Services
Repeating Group

Department Teacher               Paper    Class
Computer   A Kush                101      BCAI
                                 102      BCAI
                                 202      BSCII
           P Malik               102      BCAI
                                 105      BCAI
Math       S B Malik             123      BSCII
                                 234      BSCII
           N Bhatti              124      BCAI
                                 125      BCAI
                                 233      BSCII
                Rozy Computech Services
Non Repeating Group

         Table shows the 1st normal form
Department   Teacher                Paper       Class
Computer     A Kush             101             BCAI
Computer     A Kush             102             BCAI
Computer     A Kush             202             BSCII
Computer     Gagan Deep 102                     BCAI
Computer     Gagan Deep 105                     BCAI
Math         S B Malik          123             BSCII
Math         S B Malik          234             BSCII
Math         N Bhatti           124             BCAI
Math         N Bhatti           125             BCAI
Math         N Bhatti Rozy Computech Services
                                233             BSCII
Anomalies in 1NF

 The first normal form was related to the
structure of the representation but the second
normal form is related to eliminate data
redundancy in these relations.
 Before going to 2NF let us discuss the
problems of 1NF. The problems can be listed as.
  1. Deletion anomaly
  2. Insertion anomaly
  3. Updation anomaly
                  Rozy Computech Services
Let us consider another example
  Library order with attribute order_no,
  B_name, qty and cost. Here PK is
  composed of two attribute ( order_no
  & B_name) non key attributes are qty
  and cost. Let us consider the following
  table.
order_no B_name       qty     cost
2000     Let Us C 12          190
2000     C++          14      200
2002     DBMS         23      245
2003     C++          10      150
2008     DBMS Services 20
         Rozy Computech
                              300
Although the Library Order is in
1NF but it suffers from all
anomalies     like    Deletion,
Insertion    and      Updation
because of some attributes are
functionally dependant on
others.
To overcome such problems we
have to convert this relation
into 2NF.


  Rozy Computech Services
Second Normal Form (2NF)

• The database must meet all the requirements of the
  first normal form.
• A relation is in Second Normal Form if all non-key
  attributes are dependent on all of the key.
• If the key is a single attribute, then the relation is
  automatically in the second normal form.
• GAME Table( as in modification anomaly) can be
  decomposed to form two relations is in second
  normal form, namely S-GAME and G-FEE.
• These relations are in 2NF because they have single-
                     Rozy Computech Services
  attribute keys.
2NF
         ROLLNO      GAME                    FEE
         101         CRICKET                 500
         110         FOOTBALL                150
         135         SWIMMING                100
         180         TENNIS                  300



ROLLNO      GAME                 GAME              FEES
101         CRICKET              CRICKET           500
110         FOOTBALL             FOOTBALL          150
135         SWIMMING             SWIMMING          100
180         TENNIS               TENNIS            300
                  Rozy Computech Services
Steps to convert 2NF into 1NF
           with the previous library order
           example
 To convert a 1NF table into 2NF we may split
the table into two or more relations where any
resulting has no partial key dependency. The
procedure may be as follows.

  1. Create a new table which contains the
attribute FFD on the concatenated PK and PK
itself.

                 Rozy Computech Services
2. Create another table which contains the
  attributes that are not fully FD on PK and
  members of PK on which they are
  dependent.
  The relation is broken into two relations as
  follows.
      order relation( order_no, B_name ,qty)
      Information (B_name , cost )
                  Rozy Computech Services
order_no       B_name                qty   cost
             2000           Let Us C              12    190
                                                                     Library order
             2000           C++                   14    200
             2002           DBMS                  23    245
             2003           C++                   10    150
             2008           DBMS                  20    300



order_no   B_name           qty                          B_name             Cost
2000       Let Us C         12
                                                         Let Us C           190
2000       C++              14
                                                         C++                200
2002       DBMS             23
                                                         DBMS               300
2003       C++              10
2008       DBMS             20
                                                              Information relation
                        Rozy Computech Services
                                                        order relation
Although many shortcomings of
1NF has been removed in 2NF still in
certain cases all these three
anomalies encounter which are
discussed and removed in 3NF.




        Rozy Computech Services
Third Normal Form (3NF)

• Third normal form (3NF) requires that data
  stored in a table be dependent only on the
  primary key, and not on any other field in
  the table.
• Any field which is dependent not only on
  the primary key but also on another field
  is moved out to a separate table.
• A relation is in the third normal form if it is
   in second normal form and has no
   transitive dependencies.
                  Rozy Computech Services
Example

• Previous examples of 2NF is also for 3NF.
• Consider the Teacher relation in Table on next slide.
  Suppose the requirements underlying this relation
  are that a student (ROLLNO) can have one or more
  subjects (SUBJECT), a subject can have several
  faculty members (Tname) as Teachers, and a faculty
  member (Tname) Teaches in only one subject area.
  Teacher(ROLLNO, SUBJECT, Tname)
  Key (primary) : (ROLLNO, SUBJECT)
  Key(candidate) : (ROLLNO, Tname)
  Functional dependencies : Tname ---- SUBJECT
                     Rozy Computech Services
Relation in 3NF
         In this relation there is no
         transitive dependency
         A→B and A → C but not B →
         C
ROLLNO    SUBJECT                   TNAME
100       Math                      Ramesh Lal
120       Hindi                     Hari Chand
150       Math                      Rajneesh Kumar
160       Hindi                     Hari Chand
              Rozy Computech Services
Data Anomalies in 3NF


• 3NF helped us to remove some shortcomings
  that occurred in 2NF however still there certain
  anomalies in 3NF particularly when the relation
  has when the relation has two overlapping
  candidate keys , composite candidate keys or
  multiple candidate key.
• All these shortcomings are removed in BCNF and
  other higher normalization processes like 4NF &
  5NF.
                    Rozy Computech Services
Boyce Codd Normal Form
                     (BCNF)

• A relation is in BCNF if and only if the only
  determinants are candidate key.
• The difference between 3NF and BCNF is that
  for a Functional dependency A  B,3NF
  allows this dependency in a relation if B is a
  primary key attribute and A is not a
  candidate key, whereas BCNF insists that for
  this dependency to remain in a relation, A
  must be a candidate key.
                 Rozy Computech Services
Example of BCNF

• Relation in 3NF but not in BCNF.
                 ROLLNO    SUBJECT    TNAME
                 100       Math       Ramesh Lal
                 120       Hindi      Hari Chand
                 150       Math       Rajneesh Kumar
                 160       Hindi      Hari Chand
  S-Teacher (ROLLNO,Tname) TEACHER-SUBJECT (Tname, Subject)
  Key: ROLLNO, Tname        Key : Tname
 ROLLNO    Tname                Tname           Subject
 100       Ramesh Lal           Ramesh Lal      Math
 120       Hari Chand           Hari Chand      Hindi
 150       Rajneesh Kumar Rajneesh Kumar        Math
 160       Hari Chand Rozy Computech Services
Comparison of BCNF & 3NF


Since a BCNF is modification of 3NF so a relation
in BCNF is also in 3NF but the converse is not
true.
1. In BCNF the relation has multiple composite
    key and two or more candidate keys share a
    common attribute .
2. The FD existing in source relation may not be
    preserved in broken relations.
                   Rozy Computech Services
3. If a relation has only one
  candidate key than it can be
  normalized with 3NF or
  BCNF

4. Basically BCNF is a stronger
  definition of 3NF.




 Rozy Computech Services
Thanks !
If you have any query please mail me at
          rozygag@yahoo.com



              Rozy Computech Services

More Related Content

What's hot (20)

Normalization
NormalizationNormalization
Normalization
 
Normalisation - 2nd normal form
Normalisation - 2nd normal formNormalisation - 2nd normal form
Normalisation - 2nd normal form
 
database Normalization
database Normalizationdatabase Normalization
database Normalization
 
Lecture 04 normalization
Lecture 04 normalization Lecture 04 normalization
Lecture 04 normalization
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Entity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalizationEntity relationship diagram - Concept on normalization
Entity relationship diagram - Concept on normalization
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
functional dependencies with example
functional dependencies with examplefunctional dependencies with example
functional dependencies with example
 
Normalization in databases
Normalization in databasesNormalization in databases
Normalization in databases
 
Bsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalizationBsc cs ii-dbms-u-iv-normalization
Bsc cs ii-dbms-u-iv-normalization
 
Database Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal GulatiDatabase Normalization by Dr. Kamal Gulati
Database Normalization by Dr. Kamal Gulati
 
Normal forms
Normal formsNormal forms
Normal forms
 
Normalisation and anomalies
Normalisation and anomaliesNormalisation and anomalies
Normalisation and anomalies
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 

Viewers also liked

Relational Database Fundamentals
Relational Database FundamentalsRelational Database Fundamentals
Relational Database FundamentalsKHALID C
 
Application development with Oracle NoSQL Database 3.0
Application development with Oracle NoSQL Database 3.0Application development with Oracle NoSQL Database 3.0
Application development with Oracle NoSQL Database 3.0Anuj Sahni
 
Software Project Planning V
Software Project Planning VSoftware Project Planning V
Software Project Planning VGagan Deep
 
Software Project Planning III
Software Project Planning IIISoftware Project Planning III
Software Project Planning IIIGagan Deep
 
Software Project Planning IV
Software Project Planning IVSoftware Project Planning IV
Software Project Planning IVGagan Deep
 
C – A Programming Language- I
C – A Programming Language- IC – A Programming Language- I
C – A Programming Language- IGagan Deep
 
Software Engineering
Software Engineering Software Engineering
Software Engineering Gagan Deep
 
Fundamentals of Neural Networks
Fundamentals of Neural NetworksFundamentals of Neural Networks
Fundamentals of Neural NetworksGagan Deep
 
Normalization 1
Normalization 1Normalization 1
Normalization 1Gagan Deep
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareGagan Deep
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial IntelligenceGagan Deep
 
SQL – A Tutorial I
SQL – A Tutorial  ISQL – A Tutorial  I
SQL – A Tutorial IGagan Deep
 
Information System and MIS
Information System and MISInformation System and MIS
Information System and MISGagan Deep
 
System Analysis & Design - 2
System Analysis & Design - 2System Analysis & Design - 2
System Analysis & Design - 2Gagan Deep
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesJafar Nesargi
 
Database Management System
Database Management SystemDatabase Management System
Database Management SystemVarun Arora
 

Viewers also liked (20)

Relational Database Fundamentals
Relational Database FundamentalsRelational Database Fundamentals
Relational Database Fundamentals
 
6 normalization
6 normalization6 normalization
6 normalization
 
Application development with Oracle NoSQL Database 3.0
Application development with Oracle NoSQL Database 3.0Application development with Oracle NoSQL Database 3.0
Application development with Oracle NoSQL Database 3.0
 
Software Project Planning V
Software Project Planning VSoftware Project Planning V
Software Project Planning V
 
Software Project Planning III
Software Project Planning IIISoftware Project Planning III
Software Project Planning III
 
Software Project Planning IV
Software Project Planning IVSoftware Project Planning IV
Software Project Planning IV
 
C – A Programming Language- I
C – A Programming Language- IC – A Programming Language- I
C – A Programming Language- I
 
Software Engineering
Software Engineering Software Engineering
Software Engineering
 
Fundamentals of Neural Networks
Fundamentals of Neural NetworksFundamentals of Neural Networks
Fundamentals of Neural Networks
 
Normalization 1
Normalization 1Normalization 1
Normalization 1
 
C lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshareC lecture 4 nested loops and jumping statements slideshare
C lecture 4 nested loops and jumping statements slideshare
 
Artificial Intelligence
Artificial IntelligenceArtificial Intelligence
Artificial Intelligence
 
SQL – A Tutorial I
SQL – A Tutorial  ISQL – A Tutorial  I
SQL – A Tutorial I
 
Normalization
NormalizationNormalization
Normalization
 
Information System and MIS
Information System and MISInformation System and MIS
Information System and MIS
 
System Analysis & Design - 2
System Analysis & Design - 2System Analysis & Design - 2
System Analysis & Design - 2
 
Functional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databasesFunctional dependencies and normalization for relational databases
Functional dependencies and normalization for relational databases
 
Number system
Number systemNumber system
Number system
 
Database Management System
Database Management SystemDatabase Management System
Database Management System
 
Dbms viva questions
Dbms viva questionsDbms viva questions
Dbms viva questions
 

Similar to Normalization i i

Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.pptDeependra35
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - NormalizationMudasir Qazi
 
CIS 336 STUDY Introduction Education--cis336study.com
CIS 336 STUDY Introduction Education--cis336study.comCIS 336 STUDY Introduction Education--cis336study.com
CIS 336 STUDY Introduction Education--cis336study.comclaric262
 
CIS 336 STUDY Education Planning--cis336study.com
CIS 336 STUDY Education Planning--cis336study.comCIS 336 STUDY Education Planning--cis336study.com
CIS 336 STUDY Education Planning--cis336study.comagathachristie299
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxRoshni814224
 
Smu bsc it Spring 2014 solved assignments
Smu bsc it Spring 2014  solved assignmentsSmu bsc it Spring 2014  solved assignments
Smu bsc it Spring 2014 solved assignmentssmumbahelp
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database DesignPrabu U
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptxkshipra sony
 
03 rdbms session03
03 rdbms session0303 rdbms session03
03 rdbms session03Niit Care
 

Similar to Normalization i i (20)

Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
Chapter5.pptx
Chapter5.pptxChapter5.pptx
Chapter5.pptx
 
Normalization.ppt
Normalization.pptNormalization.ppt
Normalization.ppt
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - Normalization
 
CIS 336 STUDY Introduction Education--cis336study.com
CIS 336 STUDY Introduction Education--cis336study.comCIS 336 STUDY Introduction Education--cis336study.com
CIS 336 STUDY Introduction Education--cis336study.com
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
 
CIS 336 STUDY Education Planning--cis336study.com
CIS 336 STUDY Education Planning--cis336study.comCIS 336 STUDY Education Planning--cis336study.com
CIS 336 STUDY Education Planning--cis336study.com
 
Transaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptxTransaction Management, Recovery and Query Processing.pptx
Transaction Management, Recovery and Query Processing.pptx
 
Bscit spring driveassignments
Bscit spring driveassignmentsBscit spring driveassignments
Bscit spring driveassignments
 
B T0066
B T0066B T0066
B T0066
 
Bt0066
Bt0066Bt0066
Bt0066
 
Smu bsc it Spring 2014 solved assignments
Smu bsc it Spring 2014  solved assignmentsSmu bsc it Spring 2014  solved assignments
Smu bsc it Spring 2014 solved assignments
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
Normalization
NormalizationNormalization
Normalization
 
03 rdbms session03
03 rdbms session0303 rdbms session03
03 rdbms session03
 
Normalization.riz
Normalization.rizNormalization.riz
Normalization.riz
 
Smqa unit ii
Smqa unit iiSmqa unit ii
Smqa unit ii
 
Unit 05 dbms
Unit 05 dbmsUnit 05 dbms
Unit 05 dbms
 
Normalization
NormalizationNormalization
Normalization
 

More from Gagan Deep

Software Project Planning II
Software Project Planning IISoftware Project Planning II
Software Project Planning IIGagan Deep
 
Software Project Planning 1
Software Project Planning 1Software Project Planning 1
Software Project Planning 1Gagan Deep
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : ArraysGagan Deep
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshareGagan Deep
 
System Analysis & Design - I
System Analysis & Design - ISystem Analysis & Design - I
System Analysis & Design - IGagan Deep
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebraGagan Deep
 
Plsql overview
Plsql overviewPlsql overview
Plsql overviewGagan Deep
 

More from Gagan Deep (7)

Software Project Planning II
Software Project Planning IISoftware Project Planning II
Software Project Planning II
 
Software Project Planning 1
Software Project Planning 1Software Project Planning 1
Software Project Planning 1
 
C Programming : Arrays
C Programming : ArraysC Programming : Arrays
C Programming : Arrays
 
C lecture 3 control statements slideshare
C lecture 3 control statements slideshareC lecture 3 control statements slideshare
C lecture 3 control statements slideshare
 
System Analysis & Design - I
System Analysis & Design - ISystem Analysis & Design - I
System Analysis & Design - I
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Plsql overview
Plsql overviewPlsql overview
Plsql overview
 

Normalization i i

  • 1. Normalization - I I Gagan Deep Assistant Professor University College, Kurukshetra University, Kurukshetra & Director Rozy Computech Services, 3rd Gate, Kurukshetra University, Kurukshetra Rozy Computech Services
  • 2. In our previous lecture we discussed • Basics of Relational databases • Objectives of Normalization • Modification anomalies – Deletion Anomaly – Insertion Anomaly – Updation Anolmaly • Functional Dependencies • Armstrong’s axioms of FD etc. Now we have to talk about Normalization & Different forms of normalization. Rozy Computech Services
  • 3. NORMALIZATION Normalization is • Refinement of the database specifically ER model. • Process of removing the anomalies of database/s • Segregation of data over many entities or relations. Rozy Computech Services
  • 4. Need for Normalization • Improves database design. • Ensures minimum redundancy of data. • To make database structure flexible • Reduces need to reorganize data when design is modified or enhanced. • To achieve consistency - Removes modification anomalies. Normalized model converted to physical database tables. Rozy Computech Services
  • 5. Classes of Relation • Relation can be classified by the types of modification anomalies to which they are vulnerable. • The classes of relations and techniques for preventing anomalies are called normal forms. • Depending on its structure, a relation might be in first normal form, second normal form, third normal form or some other normal form. Rozy Computech Services
  • 6. • E.F. Codd defined first, second, and third normal forms (1NF, 2NF, 3NF). Later, Boyce- Codd normal form (BCNF) was postulated, and then fourth and fifth normal forms were designed. • Thus a relation that is in second form is also in first normal form. A relation in 5NF is also in 4NF, BCNF, 3NF, 2NF and 1NF. Rozy Computech Services
  • 7. First Normal Forms (1NF) • Every relation is, by definition, in first normal form. That is because a relation, has no repeating groups in it - that is the characteristic of the first normal form. • In easy words, only one value is associated with each attribute and the value is not a set of values or a list of values. • Let us study with the help of example about this non repeating group characteristic Rozy Computech Services
  • 8. Repeating Group Department Teacher Paper Class Computer A Kush 101 BCAI 102 BCAI 202 BSCII P Malik 102 BCAI 105 BCAI Math S B Malik 123 BSCII 234 BSCII N Bhatti 124 BCAI 125 BCAI 233 BSCII Rozy Computech Services
  • 9. Non Repeating Group Table shows the 1st normal form Department Teacher Paper Class Computer A Kush 101 BCAI Computer A Kush 102 BCAI Computer A Kush 202 BSCII Computer Gagan Deep 102 BCAI Computer Gagan Deep 105 BCAI Math S B Malik 123 BSCII Math S B Malik 234 BSCII Math N Bhatti 124 BCAI Math N Bhatti 125 BCAI Math N Bhatti Rozy Computech Services 233 BSCII
  • 10. Anomalies in 1NF The first normal form was related to the structure of the representation but the second normal form is related to eliminate data redundancy in these relations. Before going to 2NF let us discuss the problems of 1NF. The problems can be listed as. 1. Deletion anomaly 2. Insertion anomaly 3. Updation anomaly Rozy Computech Services
  • 11. Let us consider another example Library order with attribute order_no, B_name, qty and cost. Here PK is composed of two attribute ( order_no & B_name) non key attributes are qty and cost. Let us consider the following table. order_no B_name qty cost 2000 Let Us C 12 190 2000 C++ 14 200 2002 DBMS 23 245 2003 C++ 10 150 2008 DBMS Services 20 Rozy Computech 300
  • 12. Although the Library Order is in 1NF but it suffers from all anomalies like Deletion, Insertion and Updation because of some attributes are functionally dependant on others. To overcome such problems we have to convert this relation into 2NF. Rozy Computech Services
  • 13. Second Normal Form (2NF) • The database must meet all the requirements of the first normal form. • A relation is in Second Normal Form if all non-key attributes are dependent on all of the key. • If the key is a single attribute, then the relation is automatically in the second normal form. • GAME Table( as in modification anomaly) can be decomposed to form two relations is in second normal form, namely S-GAME and G-FEE. • These relations are in 2NF because they have single- Rozy Computech Services attribute keys.
  • 14. 2NF ROLLNO GAME FEE 101 CRICKET 500 110 FOOTBALL 150 135 SWIMMING 100 180 TENNIS 300 ROLLNO GAME GAME FEES 101 CRICKET CRICKET 500 110 FOOTBALL FOOTBALL 150 135 SWIMMING SWIMMING 100 180 TENNIS TENNIS 300 Rozy Computech Services
  • 15. Steps to convert 2NF into 1NF with the previous library order example To convert a 1NF table into 2NF we may split the table into two or more relations where any resulting has no partial key dependency. The procedure may be as follows. 1. Create a new table which contains the attribute FFD on the concatenated PK and PK itself. Rozy Computech Services
  • 16. 2. Create another table which contains the attributes that are not fully FD on PK and members of PK on which they are dependent. The relation is broken into two relations as follows. order relation( order_no, B_name ,qty) Information (B_name , cost ) Rozy Computech Services
  • 17. order_no B_name qty cost 2000 Let Us C 12 190 Library order 2000 C++ 14 200 2002 DBMS 23 245 2003 C++ 10 150 2008 DBMS 20 300 order_no B_name qty B_name Cost 2000 Let Us C 12 Let Us C 190 2000 C++ 14 C++ 200 2002 DBMS 23 DBMS 300 2003 C++ 10 2008 DBMS 20 Information relation Rozy Computech Services order relation
  • 18. Although many shortcomings of 1NF has been removed in 2NF still in certain cases all these three anomalies encounter which are discussed and removed in 3NF. Rozy Computech Services
  • 19. Third Normal Form (3NF) • Third normal form (3NF) requires that data stored in a table be dependent only on the primary key, and not on any other field in the table. • Any field which is dependent not only on the primary key but also on another field is moved out to a separate table. • A relation is in the third normal form if it is in second normal form and has no transitive dependencies. Rozy Computech Services
  • 20. Example • Previous examples of 2NF is also for 3NF. • Consider the Teacher relation in Table on next slide. Suppose the requirements underlying this relation are that a student (ROLLNO) can have one or more subjects (SUBJECT), a subject can have several faculty members (Tname) as Teachers, and a faculty member (Tname) Teaches in only one subject area. Teacher(ROLLNO, SUBJECT, Tname) Key (primary) : (ROLLNO, SUBJECT) Key(candidate) : (ROLLNO, Tname) Functional dependencies : Tname ---- SUBJECT Rozy Computech Services
  • 21. Relation in 3NF In this relation there is no transitive dependency A→B and A → C but not B → C ROLLNO SUBJECT TNAME 100 Math Ramesh Lal 120 Hindi Hari Chand 150 Math Rajneesh Kumar 160 Hindi Hari Chand Rozy Computech Services
  • 22. Data Anomalies in 3NF • 3NF helped us to remove some shortcomings that occurred in 2NF however still there certain anomalies in 3NF particularly when the relation has when the relation has two overlapping candidate keys , composite candidate keys or multiple candidate key. • All these shortcomings are removed in BCNF and other higher normalization processes like 4NF & 5NF. Rozy Computech Services
  • 23. Boyce Codd Normal Form (BCNF) • A relation is in BCNF if and only if the only determinants are candidate key. • The difference between 3NF and BCNF is that for a Functional dependency A  B,3NF allows this dependency in a relation if B is a primary key attribute and A is not a candidate key, whereas BCNF insists that for this dependency to remain in a relation, A must be a candidate key. Rozy Computech Services
  • 24. Example of BCNF • Relation in 3NF but not in BCNF. ROLLNO SUBJECT TNAME 100 Math Ramesh Lal 120 Hindi Hari Chand 150 Math Rajneesh Kumar 160 Hindi Hari Chand S-Teacher (ROLLNO,Tname) TEACHER-SUBJECT (Tname, Subject) Key: ROLLNO, Tname Key : Tname ROLLNO Tname Tname Subject 100 Ramesh Lal Ramesh Lal Math 120 Hari Chand Hari Chand Hindi 150 Rajneesh Kumar Rajneesh Kumar Math 160 Hari Chand Rozy Computech Services
  • 25. Comparison of BCNF & 3NF Since a BCNF is modification of 3NF so a relation in BCNF is also in 3NF but the converse is not true. 1. In BCNF the relation has multiple composite key and two or more candidate keys share a common attribute . 2. The FD existing in source relation may not be preserved in broken relations. Rozy Computech Services
  • 26. 3. If a relation has only one candidate key than it can be normalized with 3NF or BCNF 4. Basically BCNF is a stronger definition of 3NF. Rozy Computech Services
  • 27. Thanks ! If you have any query please mail me at rozygag@yahoo.com Rozy Computech Services