Disclaimer: This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
NORMALIZATION IN DATABASES
Subhin P.V
111subru@gmail.com
www.facebook.com/111subru
twitter.com/111subru
in.linkedin.com/in/Subhin P.V
8129076036
MAIN POINTS DISCUSSED
• What normalization is and what role it plays in the
database design process
• About the normal forms 1NF, 2NF, 3NF and BCNF
• How normal forms can be transformed from lower
normal forms to higher normal forms
ABOUT NORMALIZATION
• Normalization is the process of efficiently
organizing data in a database.
• Two goals of normalization process:
 Eliminating Redundant Data
 Ensuring data dependencies
• The objective is to isolate data so that changes
of a field can be made in just one table and
then propagated through the rest of the
database using the defined relationships.
Normalization Stages
• 1NF
• 2NF
• 3NF
• Boyce-Codd Normal Form (BCNF or 3.5NF)
Normalization Stages
First Normal Form (1NF)
• The values in each column of a table are
atomic (No multi-value attributes allowed).
• Each table has a primary key: minimal set of
attributes which can uniquely identify a record
• There are no repeating groups: two columns
do not store similar information in the same
table.
Second Normal Form (2NF)
• Meet all the requirements of the first normal
form.
• Remove subsets of data that apply to multiple
rows of a table and place them in separate
tables.
• Create relationships between these new
tables and their predecessors through the use
of foreign keys.
Third Normal Form (3NF)
• Meet all the requirements of the second
normal form.
• Every non-prime attribute of R is non-
transitively dependent (i.e. directly
dependent) on every superkey of R.
• Remove columns that are
not dependent upon the primary key.
Boyce-Codd Normal Form
• Meet all the requirements of the third normal
form.
• Every determinant must be a candidate key.
• Candidate Key:
 Any attribute or a set of attributes together that
has the eligibility to become a primary key.
TRANSFORMATION FROM UNF TO HIGHER
NORMAL FORMS USING AN EXAMPLE
• Example: Institution Having Two departments
– Each Department Has 6 Different Students And Some
Courses
– Each Student in a department can study more than
one Course
– Each course has its course fee.
– Periodically, report is generated that contains
information displayed which can be represented in a
table as shown in next slide.
Un-normalized Form Example
Problems With The Table
– The table displays data redundancies.
– The table has Multivalued Attributes
– The table entries invite data inconsistencies.
– The data redundancies yield the following anomalies:
• Update anomalies.
• Addition anomalies.
• Deletion anomalies.
Conversion to 1st Normal Form
Conversion To 1st Normal Form
– ADVANTAGES
• Each table has at least one minimal set of attributes
which can uniquely identify a record
• The values in each column have Single Value
– DISADVANTAGES
• Redundant data across multiple rows of the table is still
there
• Existence of partial and transitive dependencies
The Dependency diagram
– Depicts all dependencies found within given table
structure
– Helpful in getting bird’s-eye view of all
relationships among table’s attributes
– Makes it less likely that will overlook an important
dependency
Conversion to 2nd Normal Form
{Dep No, Dep_name}
{Stud no, Stud_name, Stud_DOB, Stud_age}
{Dep No, Stud No , Course_name, Course_fee}
Department Details:
Course Details: Student Details:
Conversion to 2nd Normal Form
• Advantages
– eliminates redundant data in the table
– It includes no partial dependencies:
– Create separate tables for sets of values that apply
to multiple records
• Disadvantages
– The table contains Transitive Dependencies.
– Some records depend on attributes other than
the table's primary key
Conversion to 3rd Normal Form
Student Details:
Department Details:
Course Details:
Student course:
{Dep No, Dep_name} , {Stud no, Stud_name,Stud_DOB} , {Dep No, Stud No ,
Course name} , {Course_name, Course_fee}
Conversion to 3rd Normal Form
• Advantages:
– No non-key attribute depends transitively on a
candidate key
– All The attributes in a table Depend on a single
primary key
Conversion To BCNF
• A Case where The table is in 3NF but not in
BCNF
Example of BCNF
fd1 clientNo, interviewDate  interviewTime, staffNo, roomNo (Primary Key)
fd2 staffNo, interviewDate, interviewTime clientNo (Candidate key)
fd3 roomNo, interviewDate, interviewTime  clientNo, staffNo (Candidate key)
fd4 staffNo, interviewDate  roomNo (not a candidate key)
As a consequece the ClientInterview relation may suffer from update anomalies.
For example, two tuples have to be updated if the roomNo need be changed for staffNo
SG5 on the 13-May-02.
ClientNo interviewDate interviewTime staffNo roomNo
CR76 13-May-02 10.30 SG5 G101
CR76 13-May-02 12.00 SG5 G101
CR74 13-May-02 12.00 SG37 G102
CR56 1-Jul-02 10.30 SG5 G102
ClientInterview
Example of BCNF(2)
To transform the ClientInterview relation to BCNF, we must remove the violating
functional dependency by creating two new relations called Interview and SatffRoom as
shown below,
Interview (clientNo, interviewDate, interviewTime, staffNo)
StaffRoom(staffNo, interviewDate, roomNo)
ClientNo interviewDate interviewTime staffNo
CR76 13-May-02 10.30 SG5
CR76 13-May-02 12.00 SG5
CR74 13-May-02 12.00 SG37
CR56 1-Jul-02 10.30 SG5
staffNo interviewDate roomNo
SG5 13-May-02 G101
SG37 13-May-02 G102
SG5 1-Jul-02 G102
Interview
StaffRoom
THANKS
If this presentation helped you, please visit our
page facebook.com/baabtra and like it.
Thanks in advance.
www.baabtra.com | www.massbaab.com |www.baabte.com
Contact Us

Normalization in databases

  • 2.
    Disclaimer: This presentationis prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3.
    NORMALIZATION IN DATABASES SubhinP.V 111subru@gmail.com www.facebook.com/111subru twitter.com/111subru in.linkedin.com/in/Subhin P.V 8129076036
  • 4.
    MAIN POINTS DISCUSSED •What normalization is and what role it plays in the database design process • About the normal forms 1NF, 2NF, 3NF and BCNF • How normal forms can be transformed from lower normal forms to higher normal forms
  • 5.
    ABOUT NORMALIZATION • Normalizationis the process of efficiently organizing data in a database. • Two goals of normalization process:  Eliminating Redundant Data  Ensuring data dependencies • The objective is to isolate data so that changes of a field can be made in just one table and then propagated through the rest of the database using the defined relationships.
  • 6.
    Normalization Stages • 1NF •2NF • 3NF • Boyce-Codd Normal Form (BCNF or 3.5NF)
  • 7.
  • 8.
    First Normal Form(1NF) • The values in each column of a table are atomic (No multi-value attributes allowed). • Each table has a primary key: minimal set of attributes which can uniquely identify a record • There are no repeating groups: two columns do not store similar information in the same table.
  • 9.
    Second Normal Form(2NF) • Meet all the requirements of the first normal form. • Remove subsets of data that apply to multiple rows of a table and place them in separate tables. • Create relationships between these new tables and their predecessors through the use of foreign keys.
  • 10.
    Third Normal Form(3NF) • Meet all the requirements of the second normal form. • Every non-prime attribute of R is non- transitively dependent (i.e. directly dependent) on every superkey of R. • Remove columns that are not dependent upon the primary key.
  • 11.
    Boyce-Codd Normal Form •Meet all the requirements of the third normal form. • Every determinant must be a candidate key. • Candidate Key:  Any attribute or a set of attributes together that has the eligibility to become a primary key.
  • 12.
    TRANSFORMATION FROM UNFTO HIGHER NORMAL FORMS USING AN EXAMPLE • Example: Institution Having Two departments – Each Department Has 6 Different Students And Some Courses – Each Student in a department can study more than one Course – Each course has its course fee. – Periodically, report is generated that contains information displayed which can be represented in a table as shown in next slide.
  • 13.
  • 14.
    Problems With TheTable – The table displays data redundancies. – The table has Multivalued Attributes – The table entries invite data inconsistencies. – The data redundancies yield the following anomalies: • Update anomalies. • Addition anomalies. • Deletion anomalies.
  • 15.
    Conversion to 1stNormal Form
  • 16.
    Conversion To 1stNormal Form – ADVANTAGES • Each table has at least one minimal set of attributes which can uniquely identify a record • The values in each column have Single Value – DISADVANTAGES • Redundant data across multiple rows of the table is still there • Existence of partial and transitive dependencies
  • 17.
    The Dependency diagram –Depicts all dependencies found within given table structure – Helpful in getting bird’s-eye view of all relationships among table’s attributes – Makes it less likely that will overlook an important dependency
  • 18.
    Conversion to 2ndNormal Form {Dep No, Dep_name} {Stud no, Stud_name, Stud_DOB, Stud_age} {Dep No, Stud No , Course_name, Course_fee} Department Details: Course Details: Student Details:
  • 19.
    Conversion to 2ndNormal Form • Advantages – eliminates redundant data in the table – It includes no partial dependencies: – Create separate tables for sets of values that apply to multiple records • Disadvantages – The table contains Transitive Dependencies. – Some records depend on attributes other than the table's primary key
  • 20.
    Conversion to 3rdNormal Form Student Details: Department Details: Course Details: Student course: {Dep No, Dep_name} , {Stud no, Stud_name,Stud_DOB} , {Dep No, Stud No , Course name} , {Course_name, Course_fee}
  • 21.
    Conversion to 3rdNormal Form • Advantages: – No non-key attribute depends transitively on a candidate key – All The attributes in a table Depend on a single primary key
  • 22.
    Conversion To BCNF •A Case where The table is in 3NF but not in BCNF
  • 23.
    Example of BCNF fd1clientNo, interviewDate  interviewTime, staffNo, roomNo (Primary Key) fd2 staffNo, interviewDate, interviewTime clientNo (Candidate key) fd3 roomNo, interviewDate, interviewTime  clientNo, staffNo (Candidate key) fd4 staffNo, interviewDate  roomNo (not a candidate key) As a consequece the ClientInterview relation may suffer from update anomalies. For example, two tuples have to be updated if the roomNo need be changed for staffNo SG5 on the 13-May-02. ClientNo interviewDate interviewTime staffNo roomNo CR76 13-May-02 10.30 SG5 G101 CR76 13-May-02 12.00 SG5 G101 CR74 13-May-02 12.00 SG37 G102 CR56 1-Jul-02 10.30 SG5 G102 ClientInterview
  • 24.
    Example of BCNF(2) Totransform the ClientInterview relation to BCNF, we must remove the violating functional dependency by creating two new relations called Interview and SatffRoom as shown below, Interview (clientNo, interviewDate, interviewTime, staffNo) StaffRoom(staffNo, interviewDate, roomNo) ClientNo interviewDate interviewTime staffNo CR76 13-May-02 10.30 SG5 CR76 13-May-02 12.00 SG5 CR74 13-May-02 12.00 SG37 CR56 1-Jul-02 10.30 SG5 staffNo interviewDate roomNo SG5 13-May-02 G101 SG37 13-May-02 G102 SG5 1-Jul-02 G102 Interview StaffRoom
  • 25.
  • 26.
    If this presentationhelped you, please visit our page facebook.com/baabtra and like it. Thanks in advance. www.baabtra.com | www.massbaab.com |www.baabte.com
  • 27.