SlideShare a Scribd company logo
Database Sytem and Design
ITM Dept.
Second Stage
2022-2023
Database Normalization
A.Lecturer: Nareen O.Muhamad
Email: nareen.mohameed@dpu.edu.krd
Objectives
• Database Normalization
• Database Normal Forms
• First Normal Form- 1NF
• Second Normal Form- 2NF
• Third Normal Form- 3NF
What is database normalization?
• Database normalization is the process of organizing data to minimize data redundancy (data
duplication), which in turn ensures data consistency.
• Problems of Redundant data.
1. Disk space wastage.
2. Data inconsistency.
3. DML queries (Insert, Update, Delete) can become slow.
Problems of Redundant data
• Consider Employees table below. For every employee with in the same department, we are
repeating, all the 3 columns (DeptName, DeptHead and DeptLocation). Let's say for example,
if there 50 thousand employees in the IT department, we would have unnecessarily repeated
all the 3 department columns (DeptName, DeptHead and DeptLocation) data 50 thousand
times. The obvious problem with redundant data is the disk space wastage.
• Another common problem, is that data can become inconsistent.
For example, let's say, JOHN has resigned and we have a new department head (STEVE) for IT
department At present, there are 3 IT department rows in the table, and we need to update all of
them. Let's assume I updated only one, row and forgot to update the other 2 rows, then obviously, the
data becomes inconsistent
• Another problem, DML queries (Insert, update and
delete), could become slow, as there could many records and
columns to process.
To Reduce the data redundancy
• we can divide this large badly organized table into two (Employees and Departments), as
shown below. Now, we have reduced redundant department data. So, if we have to update
department head name, we only have one row to update, even if there are 10 million
employees in that department.
Database Normal Forms
• There are 6 normal forms, First Normal form (1NF) thru Sixth
Normal Form (6NF). Most databases are in third normal form
(3NF). There are certain rules, that each normal form should
follow.
First Normal Form (1NF)
• A table is said to be in 1NF, if
1. The data in each column should be atomic. No multiple values, separated by comma.
2. The table does not contain any repeating column groups.
3. Identify each record uniquely using primary key.
First Normal Form (1NF)
• In the table below, data in Employee column is not atomic. It contains
multiple employees separated by comma
Problems of Non Atomic Columns
it is not possible to SELECT, INSERT, UPDATE and DELETE just one employee.
First Normal Form (1NF)
• The 2nd rule of the first normal form is that, the table should not contain any repeating
column groups.
 Problems repeating column groups
• Table structure change required: if a department is going to add a new
employees.
• wasted disk space: Employee2 and Employee3 columns in the HR department
are NULL, as there is only one employee in this department.
First Normal Form (1NF)
To eliminate the repeating column groups, we are dividingthe table into 2.
The repeating Employee columns are moved into a separate table, with a
foreign key pointing to the primary key of the other table. We also, introduced
primary key to uniquely identify each record.
Second Normal Form (2NF)
• A table is said to be in 2NF, if
1.The table meets all the conditions of1NF.
2.Move redundant data to a separatetable.
3.Create relationship between these tables using foreign keys.
Second Normal Form (2NF)
The table below violates second normal form. There is lot of redundant data
in the table. Let's say, in my organization there are
• 100,000 employees and only 2 departments (IT & HR). Since we are storing DeptName,
DeptHead and DeptLocation columns also in the same table, all these columns should also
be repeated 100,000 times, which results in unnecessary duplicate on of data.
Second Normal Form (2NF)
• Now, to put this table in the second normal form, we need to break the table
into 2, and move the redundant department data (DeptName, DeptHead and
DeptLocation) into it's own table. To link the tables with each other, we use the
DeptId foreign key. The tables below are in 2NF.
Third Normal Form (3NF)
A table is said to be in 3NF, if the table
1. Meets all the conditions of 1NF and 2NF.
2. Does not contain columns (attributes) that are not fully dependent upon the primary
key.
Third Normal Form (3NF)
• The table below, violates third normal form, because AnnualSalary column is not
fully dependent on the primary key EmpId. The AnnualSalary is
• also dependent on the Salary column. In fact, to compute the AnnualSalary, we multiply
the Salary by 12. Since AnnualSalary is not fully dependent on the primary key, and it
can be computed, we can remove this column from the table, which then, will adhere to
3NF.
Third Normal Form (3NF)
 Let's look at another example of Third Normal Form violation. In the table below,
DeptHead column is not fully dependent on EmpId column. DeptHead is also dependent
on DeptName. So, this table is not in 3NF.
Third Normal Form (3NF)
To put this table in 3NF, we break this down into 2, and then move all the
columns that are not fully dependent on the primary keyto
• a separate table as shown below. This design is now in 3NF.
End Of Lecture

More Related Content

Similar to Lecture 6.pptx

Jai dbms
Jai dbmsJai dbms
Jai dbms
JAI BAMORIYA
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
A. S. M. Shafi
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
arjunstores123
 
Sap abap
Sap abapSap abap
Sap abap
Jugul Crasta
 
Data Modeling
Data ModelingData Modeling
Data Modeling
DrkhanchanaR
 
Normalization
NormalizationNormalization
Normalization
Ramesh 4
 
Introduction to the Relational Model and SQL
Introduction to the Relational Model and SQLIntroduction to the Relational Model and SQL
Introduction to the Relational Model and SQL
LGS, GBHS&IC, University Of South-Asia, TARA-Technologies
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
Sunita Milind Dol
 
databaess.pptx
databaess.pptxdatabaess.pptx
databaess.pptx
Janoakre
 
Normalization.pptx
Normalization.pptxNormalization.pptx
Normalization.pptx
Sreenivas R
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
kshipra sony
 
Normalization of database tables
Normalization of database tablesNormalization of database tables
Normalization of database tables
Dhani Ahmad
 
Lecture 02-2-IIS.pptx
Lecture 02-2-IIS.pptxLecture 02-2-IIS.pptx
Lecture 02-2-IIS.pptx
Asadkhan47384
 
Chapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptxChapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptx
haymanot taddesse
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Biplap Bhattarai
 
Database Normalization.docx
Database Normalization.docxDatabase Normalization.docx
Database Normalization.docx
SHARMISTHAlearning
 
Notes of Information technology
Notes of Information technology Notes of Information technology
Notes of Information technology
Asif Jamal
 
Normalization case
Normalization caseNormalization case
Normalization case
Prosanta Ghosh
 
Faq dbms
Faq dbmsFaq dbms
Internal tables in sap
Internal tables in sapInternal tables in sap
Internal tables in sap
Dharma Raju
 

Similar to Lecture 6.pptx (20)

Jai dbms
Jai dbmsJai dbms
Jai dbms
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
What is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdfWhat is Database NormalizationExplain the guidelines for ensuring t.pdf
What is Database NormalizationExplain the guidelines for ensuring t.pdf
 
Sap abap
Sap abapSap abap
Sap abap
 
Data Modeling
Data ModelingData Modeling
Data Modeling
 
Normalization
NormalizationNormalization
Normalization
 
Introduction to the Relational Model and SQL
Introduction to the Relational Model and SQLIntroduction to the Relational Model and SQL
Introduction to the Relational Model and SQL
 
Assignment#11
Assignment#11Assignment#11
Assignment#11
 
databaess.pptx
databaess.pptxdatabaess.pptx
databaess.pptx
 
Normalization.pptx
Normalization.pptxNormalization.pptx
Normalization.pptx
 
Presentation on Normalization.pptx
Presentation on Normalization.pptxPresentation on Normalization.pptx
Presentation on Normalization.pptx
 
Normalization of database tables
Normalization of database tablesNormalization of database tables
Normalization of database tables
 
Lecture 02-2-IIS.pptx
Lecture 02-2-IIS.pptxLecture 02-2-IIS.pptx
Lecture 02-2-IIS.pptx
 
Chapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptxChapter Four Logical Database Design (Normalization).pptx
Chapter Four Logical Database Design (Normalization).pptx
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
Database Normalization.docx
Database Normalization.docxDatabase Normalization.docx
Database Normalization.docx
 
Notes of Information technology
Notes of Information technology Notes of Information technology
Notes of Information technology
 
Normalization case
Normalization caseNormalization case
Normalization case
 
Faq dbms
Faq dbmsFaq dbms
Faq dbms
 
Internal tables in sap
Internal tables in sapInternal tables in sap
Internal tables in sap
 

More from DilanAlmsa

Stakeholder Infographics by Slidesgo.pptx
Stakeholder Infographics by Slidesgo.pptxStakeholder Infographics by Slidesgo.pptx
Stakeholder Infographics by Slidesgo.pptx
DilanAlmsa
 
C++ Strings.ppt
C++ Strings.pptC++ Strings.ppt
C++ Strings.ppt
DilanAlmsa
 
Programming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptxProgramming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptx
DilanAlmsa
 
lecture1-2023.pptx
lecture1-2023.pptxlecture1-2023.pptx
lecture1-2023.pptx
DilanAlmsa
 
lecture-5 string.pptx
lecture-5 string.pptxlecture-5 string.pptx
lecture-5 string.pptx
DilanAlmsa
 
Java22_1670144363.pptx
Java22_1670144363.pptxJava22_1670144363.pptx
Java22_1670144363.pptx
DilanAlmsa
 

More from DilanAlmsa (6)

Stakeholder Infographics by Slidesgo.pptx
Stakeholder Infographics by Slidesgo.pptxStakeholder Infographics by Slidesgo.pptx
Stakeholder Infographics by Slidesgo.pptx
 
C++ Strings.ppt
C++ Strings.pptC++ Strings.ppt
C++ Strings.ppt
 
Programming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptxProgramming Lesson by Slidesgo.pptx
Programming Lesson by Slidesgo.pptx
 
lecture1-2023.pptx
lecture1-2023.pptxlecture1-2023.pptx
lecture1-2023.pptx
 
lecture-5 string.pptx
lecture-5 string.pptxlecture-5 string.pptx
lecture-5 string.pptx
 
Java22_1670144363.pptx
Java22_1670144363.pptxJava22_1670144363.pptx
Java22_1670144363.pptx
 

Recently uploaded

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
WaniBasim
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
RitikBhardwaj56
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
heathfieldcps1
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
Priyankaranawat4
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Dr. Vinod Kumar Kanvaria
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
eBook.com.bd (প্রয়োজনীয় বাংলা বই)
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
Nicholas Montgomery
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 

Recently uploaded (20)

Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
Liberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdfLiberal Approach to the Study of Indian Politics.pdf
Liberal Approach to the Study of Indian Politics.pdf
 
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...The simplified electron and muon model, Oscillating Spacetime: The Foundation...
The simplified electron and muon model, Oscillating Spacetime: The Foundation...
 
The basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptxThe basics of sentences session 6pptx.pptx
The basics of sentences session 6pptx.pptx
 
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdfANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
ANATOMY AND BIOMECHANICS OF HIP JOINT.pdf
 
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdfবাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
বাংলাদেশ অর্থনৈতিক সমীক্ষা (Economic Review) ২০২৪ UJS App.pdf
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
writing about opinions about Australia the movie
writing about opinions about Australia the moviewriting about opinions about Australia the movie
writing about opinions about Australia the movie
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 

Lecture 6.pptx

  • 1. Database Sytem and Design ITM Dept. Second Stage 2022-2023 Database Normalization A.Lecturer: Nareen O.Muhamad Email: nareen.mohameed@dpu.edu.krd
  • 2. Objectives • Database Normalization • Database Normal Forms • First Normal Form- 1NF • Second Normal Form- 2NF • Third Normal Form- 3NF
  • 3. What is database normalization? • Database normalization is the process of organizing data to minimize data redundancy (data duplication), which in turn ensures data consistency. • Problems of Redundant data. 1. Disk space wastage. 2. Data inconsistency. 3. DML queries (Insert, Update, Delete) can become slow.
  • 4. Problems of Redundant data • Consider Employees table below. For every employee with in the same department, we are repeating, all the 3 columns (DeptName, DeptHead and DeptLocation). Let's say for example, if there 50 thousand employees in the IT department, we would have unnecessarily repeated all the 3 department columns (DeptName, DeptHead and DeptLocation) data 50 thousand times. The obvious problem with redundant data is the disk space wastage.
  • 5. • Another common problem, is that data can become inconsistent. For example, let's say, JOHN has resigned and we have a new department head (STEVE) for IT department At present, there are 3 IT department rows in the table, and we need to update all of them. Let's assume I updated only one, row and forgot to update the other 2 rows, then obviously, the data becomes inconsistent
  • 6. • Another problem, DML queries (Insert, update and delete), could become slow, as there could many records and columns to process.
  • 7. To Reduce the data redundancy • we can divide this large badly organized table into two (Employees and Departments), as shown below. Now, we have reduced redundant department data. So, if we have to update department head name, we only have one row to update, even if there are 10 million employees in that department.
  • 8. Database Normal Forms • There are 6 normal forms, First Normal form (1NF) thru Sixth Normal Form (6NF). Most databases are in third normal form (3NF). There are certain rules, that each normal form should follow.
  • 9. First Normal Form (1NF) • A table is said to be in 1NF, if 1. The data in each column should be atomic. No multiple values, separated by comma. 2. The table does not contain any repeating column groups. 3. Identify each record uniquely using primary key.
  • 10. First Normal Form (1NF) • In the table below, data in Employee column is not atomic. It contains multiple employees separated by comma Problems of Non Atomic Columns it is not possible to SELECT, INSERT, UPDATE and DELETE just one employee.
  • 11. First Normal Form (1NF) • The 2nd rule of the first normal form is that, the table should not contain any repeating column groups.  Problems repeating column groups • Table structure change required: if a department is going to add a new employees. • wasted disk space: Employee2 and Employee3 columns in the HR department are NULL, as there is only one employee in this department.
  • 12. First Normal Form (1NF) To eliminate the repeating column groups, we are dividingthe table into 2. The repeating Employee columns are moved into a separate table, with a foreign key pointing to the primary key of the other table. We also, introduced primary key to uniquely identify each record.
  • 13. Second Normal Form (2NF) • A table is said to be in 2NF, if 1.The table meets all the conditions of1NF. 2.Move redundant data to a separatetable. 3.Create relationship between these tables using foreign keys.
  • 14. Second Normal Form (2NF) The table below violates second normal form. There is lot of redundant data in the table. Let's say, in my organization there are • 100,000 employees and only 2 departments (IT & HR). Since we are storing DeptName, DeptHead and DeptLocation columns also in the same table, all these columns should also be repeated 100,000 times, which results in unnecessary duplicate on of data.
  • 15. Second Normal Form (2NF) • Now, to put this table in the second normal form, we need to break the table into 2, and move the redundant department data (DeptName, DeptHead and DeptLocation) into it's own table. To link the tables with each other, we use the DeptId foreign key. The tables below are in 2NF.
  • 16. Third Normal Form (3NF) A table is said to be in 3NF, if the table 1. Meets all the conditions of 1NF and 2NF. 2. Does not contain columns (attributes) that are not fully dependent upon the primary key.
  • 17. Third Normal Form (3NF) • The table below, violates third normal form, because AnnualSalary column is not fully dependent on the primary key EmpId. The AnnualSalary is • also dependent on the Salary column. In fact, to compute the AnnualSalary, we multiply the Salary by 12. Since AnnualSalary is not fully dependent on the primary key, and it can be computed, we can remove this column from the table, which then, will adhere to 3NF.
  • 18. Third Normal Form (3NF)  Let's look at another example of Third Normal Form violation. In the table below, DeptHead column is not fully dependent on EmpId column. DeptHead is also dependent on DeptName. So, this table is not in 3NF.
  • 19. Third Normal Form (3NF) To put this table in 3NF, we break this down into 2, and then move all the columns that are not fully dependent on the primary keyto • a separate table as shown below. This design is now in 3NF.