SlideShare une entreprise Scribd logo
1  sur  20
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

Contenu connexe

Similaire à Lecture 6.pptx

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
 
Notes of Information technology
Notes of Information technology Notes of Information technology
Notes of Information technology
Asif Jamal
 

Similaire à 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
 

Plus de 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
 

Dernier

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
negromaestrong
 

Dernier (20)

Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 

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.