DBMS Normalization
DBMS Normalization
- Vaidehi Raval
Database Normalization
• Normalization
• First Normal Form (1 NF)
• Primary Key
• Composite Key
• Foreign Key
• Second Normal Form (2 NF)
• What is a Transitive Functional Dependency?
• Third Normal Form (3 NF)
Normalization
2
Database Normalization
Normalization
• Normalization is a database design technique which organizes tables in a manner that
reduces redundancy and dependency of data.
• It divides larger tables to smaller tables and links them using relationships.
• Theory of Normalization is still being developed further. For example there are
discussions even on 6th Normal Form. But in most practical applications normalization
achieves its best in 3rd Normal Form. The evolution of Normalization theories is
illustrated below-
Normalization
3
Database Normalization
Patient Name Salutation Gender Marital Status Visit Purpose Visit Fees Visit Date
Here you see Visit Purpose, Visit Fees and Visit Date column have multiple values.
Normalization
4
Database Normalization
First Normal Form (1 NF)
No Repeating Elements or Groups of Elements
• Each table cell should contain single value
• Each record needs to be unique
Patient Name Salutation Gender Marital Status Visit Purpose Visit Fees Visit Date
Janet Jones Ms. Female Single Dental Consultation 200 12-Jan-2012
Janet Jones Ms. Female Single Root Canal 500 15-Jan-2012
Robert Phil Mr. Male Single CT - Chest 250 14-Dec-2011
Robert Phil Mr. Male Single CBC 90 12-Dec-2011
Robert Phil Mr. Male Single ESR 140 13-Dec-2011
Josh Mathews Mr. Male Married Endoscopy 500 11-Feb-2012
Janet Jones Mrs. Female Married X-Ray 60 21-Jan-2012
Janet Jones Mrs. Female Married Cardiology Consultation 210 22-Jan-2012
Normalization
5
Database Normalization
Primary Key
Tip: Columns in a table that are NOT used to uniquely identify a record are called non-key
columns
Normalization
6
Database Normalization
Composite Key
Patient Name Salutation Gender Marital Status Visit Purpose Visit Fees Visit Date
Janet Jones Ms. Female Single Dental 200, 500 12-Jan-2012,
Consultation, 15-Jan-2012
Root Canal
Janet Jones Mrs. Female Married Cardiology 210, 60 22-Jan-2012,
Consultation, X- 21-Jan-2012
Ray
Robert Phil Mr. Male Single CT - Chest, CBC, 250, 90,140 14-Dec-2011,
ESR 12-Dec-2011,
13-Dec-2011
• Names of patients are common, hence a composite key (composition of Name and
Maritial Status column) is needed to uniquely identify a record
Normalization 7
Database Normalization
Foreign Key
Normalization
8
Database Normalization
Second Normal Form (2 NF)
• Must be in 1 NF
• The non key columns must not depend on part of composite primary key, hence
implement a single column primary key
PK Patient ID Patient Name Salutation Gender Marital Status • We have divided our 1NF
1 Janet Jones Ms. Female Single
table into two tables viz.
Patient and PatientVisit.
2 Robert Phil Mr. Male Single
3 Josh Mathews Mr. Male Married
• Introduced a new column
called Patient ID which is
4 Janet Jones Mrs. Female Married
the primary key for Patient
FK table. Records can be
Patient ID Visit Purpose Visit Fees Visit Date
uniquely identified using
1 Dental Consultation 200 12-Jan-2012
Patient ID.
1 Root Canal 500 15-Jan-2012
• Patient ID is used as a
2 CT - Chest 250 14-Dec-2011
Foreign key in PatientVisit
2 CBC 90 12-Dec-2011 table
2 ESR 140 13-Dec-2011
3 Endoscopy 500 11-Feb-2012
4 X-Ray 60 21-Jan-2012
4 Cardiology Consultation 210 22-Jan-2012
Normalization 9
Database Normalization
• In above example, a change in a non key column name may cause a change in
other non key column Salutation
Normalization
10
Database Normalization
Third Normal Form (3 NF)
FK
PK PK Sal ID Salutation
Patient ID Patient Name Sal ID Gender Marital Status
1 Janet Jones 1 Female Single 1 Ms.
2 Robert Phil 2 Male Single 2 Mr.
3 Josh Mathews 2 Male Married 3 Mrs.
4 Janet Jones 3 Female Married 4 Dr.
Normalization
11
Thank You
- Vaidehi Raval
12