FIVE NORMAL FORMS IN
RELATIONAL DATABASE THEORY
- AIME
TODAY’s CONTENT
 Why we have to learn database normalization
 Bad Relational Database Design – unnormalized
 5 Normalization Forms
 Better Relational Database Design - normailized
 Conclusion
Why normalization?
 Database Design
 Minimize Data Redundancy from UPDATE ANOMALIES
 UPDATE ANOMALIES
 Insertion anomalies
 Deletion anomalies
 Modification anomalies
Update Anomalies
Insert?
Insert? DATA
REDUNDANCY!
Delete?
Delete?
OTHER IMPORTANT
INFORMATIONS
MIGHT BE DELETED
Modify?
Modify?
MIGHT CAUSE
INCONSISTENCY
PROBLEM
BAD DATABASE DESIGN
Normalization
Unnormalization
form
1st normalization
form
2nd normalization
form
3rd normalization
form
4th normalization
form
5th normalization
form
Remove
repeating
group
Remove partial
dependencies
Remove
transitive
dependencies
Remove remaining
anomalies from
functional
dependencies
Remove multi-value
dependencies
join
dependencies
Unnormalized Form
Unnormalized Form to 1st Normalized Form
1st Normalized Form problem
 Data Redundancy
 Might cause inconsistency problem
Move to 2nd Normalized Form
Conditions
 It’s already in 1st normalized form
 All attributes have fully functional dependency with primary key, NOT partial dependency
 Get rid of Partial dependencies
Move to 2nd Normalized Form
Partial Dependency
 Non-prime field(s) depends on one primary key
 Student_ID + Course_ID Firstname, Surname, Cum.GPA, Position_ID, Position, Scholarship, Course_ID, Course, Credit, Grade, Lecturer_ID, Lecturer
 Student_ID Firstname, Surname, Cum.GPA, Position_ID, Position, Scholarship
 Course_ID  Course, Credit, Grade, Lecturer_ID, Lecturer
 Student_ID + Course_ID Grade
PK PK
PK: Primary Key
FK: Foreign Key
FK FK
2nd Normalized Form
 Separate into relation tables...
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation Table
Move to 3rd Normalized Form
Conditions
 It’s already in 2nd normalized form
 Get rid of Transitive Dependency
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation Table
Move to 3rd Normalized Form
Transitive Dependency
 Other attributes, those are not a primary key, cannot define the value of other
attributes
PK
Student Relation
Non-PK
3rd Normalized Form
 Separate into relation tables...
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation
FK
PK
Position Relation
3rd Normalized Form
 Separate into relation tables...
PK
Student Relation
FK FK
Student-Course Relation
FK
PK
Position Relation
PK Course Relation FK PK Lecturer Relation
Move to 4th Normalized Form
Conditions
 It’s in 3rd normalized form
 Get rid of multi-valued dependencies
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation
FK
PK Position Relation
FK PK Lecturer Relation
Move to 4th Normalized Form
Conditions
 It’s in 3rd normalized form
 Get rid of multi-valued dependencies
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation
FK
PK Position Relation
FK PK Lecturer Relation
Add Research for each lecturer
Move to 4th Normalized Form
Multi-valued Dependencies
 AB; Lecturer_IDLecturer
 AC; Lecturer_IDResearch
 But B and C is independent
A B C
PK
PK
Lecturer Relation
Lecturer-Research Relation
Final Form – 4th Normalized Form
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation
FK
PK Position Relation
FK PK Lecturer Relation PK Lecturer-Research Relation
5th Normalized Form
 Separate more relation and it’s able to join back without spurious tuple occurance
No spurious tuple
PK Position Relation
PK Position Relation
Supurios Tuple Example
????
Spurious tuple exist!!
PK
PK
Student Relation
Course Relation
FK FK
Student-Course Relation
FK
PK Position Relation
FK PK Lecturer Relation PK Lecturer-Research Relation
OLD
version
NEW version
Conclusion
 The purpose of normalization is to
 Reduce data redundacy
 Prevent data inconsistency
 Trade-off
 Performance
 The factors to be considered while normalization
 Single-valued vs Multivalued
 Dependencies
 Partial dependency
 Transitive dependency
 Functional dependency
 Multivalued dependency
 Key and non-Key field relationship

5 normal forms in relational database theory

  • 1.
    FIVE NORMAL FORMSIN RELATIONAL DATABASE THEORY - AIME
  • 2.
    TODAY’s CONTENT  Whywe have to learn database normalization  Bad Relational Database Design – unnormalized  5 Normalization Forms  Better Relational Database Design - normailized  Conclusion
  • 3.
    Why normalization?  DatabaseDesign  Minimize Data Redundancy from UPDATE ANOMALIES  UPDATE ANOMALIES  Insertion anomalies  Deletion anomalies  Modification anomalies
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
    Normalization Unnormalization form 1st normalization form 2nd normalization form 3rdnormalization form 4th normalization form 5th normalization form Remove repeating group Remove partial dependencies Remove transitive dependencies Remove remaining anomalies from functional dependencies Remove multi-value dependencies join dependencies
  • 13.
  • 14.
    Unnormalized Form to1st Normalized Form
  • 15.
    1st Normalized Formproblem  Data Redundancy  Might cause inconsistency problem
  • 16.
    Move to 2ndNormalized Form Conditions  It’s already in 1st normalized form  All attributes have fully functional dependency with primary key, NOT partial dependency  Get rid of Partial dependencies
  • 17.
    Move to 2ndNormalized Form Partial Dependency  Non-prime field(s) depends on one primary key  Student_ID + Course_ID Firstname, Surname, Cum.GPA, Position_ID, Position, Scholarship, Course_ID, Course, Credit, Grade, Lecturer_ID, Lecturer  Student_ID Firstname, Surname, Cum.GPA, Position_ID, Position, Scholarship  Course_ID  Course, Credit, Grade, Lecturer_ID, Lecturer  Student_ID + Course_ID Grade PK PK PK: Primary Key FK: Foreign Key FK FK
  • 18.
    2nd Normalized Form Separate into relation tables... PK PK Student Relation Course Relation FK FK Student-Course Relation Table
  • 19.
    Move to 3rdNormalized Form Conditions  It’s already in 2nd normalized form  Get rid of Transitive Dependency PK PK Student Relation Course Relation FK FK Student-Course Relation Table
  • 20.
    Move to 3rdNormalized Form Transitive Dependency  Other attributes, those are not a primary key, cannot define the value of other attributes PK Student Relation Non-PK
  • 21.
    3rd Normalized Form Separate into relation tables... PK PK Student Relation Course Relation FK FK Student-Course Relation FK PK Position Relation
  • 22.
    3rd Normalized Form Separate into relation tables... PK Student Relation FK FK Student-Course Relation FK PK Position Relation PK Course Relation FK PK Lecturer Relation
  • 23.
    Move to 4thNormalized Form Conditions  It’s in 3rd normalized form  Get rid of multi-valued dependencies PK PK Student Relation Course Relation FK FK Student-Course Relation FK PK Position Relation FK PK Lecturer Relation
  • 24.
    Move to 4thNormalized Form Conditions  It’s in 3rd normalized form  Get rid of multi-valued dependencies PK PK Student Relation Course Relation FK FK Student-Course Relation FK PK Position Relation FK PK Lecturer Relation Add Research for each lecturer
  • 25.
    Move to 4thNormalized Form Multi-valued Dependencies  AB; Lecturer_IDLecturer  AC; Lecturer_IDResearch  But B and C is independent A B C PK PK Lecturer Relation Lecturer-Research Relation
  • 26.
    Final Form –4th Normalized Form PK PK Student Relation Course Relation FK FK Student-Course Relation FK PK Position Relation FK PK Lecturer Relation PK Lecturer-Research Relation
  • 27.
    5th Normalized Form Separate more relation and it’s able to join back without spurious tuple occurance No spurious tuple PK Position Relation PK Position Relation
  • 28.
  • 29.
    PK PK Student Relation Course Relation FKFK Student-Course Relation FK PK Position Relation FK PK Lecturer Relation PK Lecturer-Research Relation OLD version NEW version
  • 30.
    Conclusion  The purposeof normalization is to  Reduce data redundacy  Prevent data inconsistency  Trade-off  Performance  The factors to be considered while normalization  Single-valued vs Multivalued  Dependencies  Partial dependency  Transitive dependency  Functional dependency  Multivalued dependency  Key and non-Key field relationship