SlideShare a Scribd company logo
NORMALIZATION
Instructor:
Mehwashma Amir
E-R Model and Normalization/
Session 2 1
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
2
E-R Model and Normalization/ Session 2
 Initially, all databases are characterized by large number of columns and records.
 This approach has certain drawbacks.
 The following table consist of details of the employees and the project they are
working on.
Repetition Anomaly
 The data such as Project_id, Project_name, Grade, and Salary repeat
many times.
 This repetition hampers both, performance during retrieval of data and the storage
capacity.
 This repetition of data is called the repetition anomaly.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
3
E-R Model and Normalization/ Session 2
 The repetition is shown in the following table with the help of shaded cells:
Insertion Anomaly
 Suppose the department recruits a new employee named Ann.
 Consider that Ann has not been assigned any project. Insertion of her details in the
table would leave columns Project_id and Project_name empty.
 Leaving columns blank could lead to problems later.
 Anomalies created by such insertions are called insertion anomalies as shown in
the following table:
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
4
E-R Model and Normalization/ Session 2
Deletion Anomaly
 Suppose, Bob is relieved from the project MAGNUM.
 Deleting the record deletes Bob's Emp_no, Grade, and Salary details too.
 This loss of data is harmful as all of Bob's personal details are also lost.
 This kind of loss of data due to deletion is called deletion anomaly as can be seen in
the following table:
Updating Anomaly
 Suppose John was given a hike in Salary or John was demoted.
 The change in John's Salary or Grade needs to be reflected in all projects John
works for.
 This problem in updating all the occurrences is called updating anomaly.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
5
E-R Model and Normalization/ Session 2
The Department Employee Details table is called an unnormalized table.
These drawbacks lead to the need for normalization.
Normalization is the process of removing unwanted redundancy and dependencies.
Initially, Codd (1972) presented three normal forms (1NF, 2NF, and 3NF), all based
on dependencies among the attributes of a relation.
The fourth and fifth normal forms are based on multi value and join dependencies
and were proposed later.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
6
E-R Model and Normalization/ Session 2
1
• Create separate tables for each group of related data.
2
• The table columns must have atomic values.
3
• All the key attributes must be identified.
 In order to achieve the first normal form, following steps need to be performed:
 Consider the Employee Project Details table as follows:
 The table has data related to projects and employees.
 The table needs to be split into two tables, that is, a Project Details table
and an Employee Details table.
 The table columns, Project_id and Project_names, have multiple values.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
7
E-R Model and Normalization/ Session 2
 The data needs to be split over different rows.
 The resultant tables are Project Details and Employee Details as
follows:
Project Details
Employee Details
 The Project_id attribute is the primary key for the Project Details table.
 The Emp_no attribute is the primary key for the Employee Details table.
 Therefore, in first normal form, the initial Employee Project Details table
has been reduced to the Project Details and Employee Details tables.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
8
E-R Model and Normalization/ Session 2
 The tables are said to be in second normal form if:
 Partial dependency means a non-key attribute should not be partially dependent
on more than one key attribute.
 The Project Details and Employee Details tables do not exhibit any
partial dependencies.
 The Project_name is dependent only on Project_id and Emp_name,
Grade, and Salary are dependant only on Emp_no.
 The tables also need to be related through foreign keys.
 A third table, named Employee Project Details, is created with only two
columns, Project_id and Emp_no.
They meet the requirements of the first normal form.
There are no partial dependencies in the tables.
The tables are related through foreign keys.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
9
E-R Model and Normalization/ Session 2
 So, the project and employee details tables on conversion to second normal form
generates tables Project Details, Employee Details, and Employee
Project Details as follows:
Project Details
Employee Project Details
Employee Details
 The attributes, Emp_no and Project_id, of the Employee Project
Details table combine together to form the primary key.
 Such primary keys are called composite primary keys.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
10
E-R Model and Normalization/ Session 2
 To achieve the third normal form:
The tables should meet the requirements of the second normal form
The tables should not have transitive dependencies in them
 The Project Details, Employee Details, and Employee Project
Details tables are in second normal form.
 If an attribute can be determined by another non-key attribute, it is called a
transitive dependency.
 That is, every non-key attribute should be determined by the key attribute only.
 If a non-key attribute can be determined by another non-key attribute, it needs to
put into another table.
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
11
E-R Model and Normalization/ Session 2
 On observing the different tables, it is seen that the Project Details and
Employee Project Details tables do not exhibit any such transitive
dependencies.
 The non-key attributes are totally determined by the key attributes.
 Project_name is only determined by Project_number.
 On further scrutinizing the Employee Details table, a certain inconsistency is
seen.
 The attribute Salary is determined by the attribute Grade and not the key
attribute Emp_no.
 Thus, this transitive dependency needs to be removed.
 The Employee Details table can be split into Employee Details and
Grade Salary Details tables as follows:
Employee Details Grade Salary Details
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
12
E-R Model and Normalization/ Session 2
 Thus, at the end of the three normalization stages, the initial Employee
Project Details table has been reduced to the Project Details,
Employee Project Details, Employee Details, and Grade Salary
Details tables as follows:
Employee Details Grade Salary Details
Project Details
Employee Project Details
SQL
Server
2012
© Aptech Ltd.
SQL
Server
2012
13
E-R Model and Normalization/ Session 2
By normalizing a database, redundancy is reduced.
This, in turn, reduces the storage requirements for the database and ensures data
integrity.
However, it has following drawbacks:
Complex join queries may have to be written often to combine the data in
multiple tables.
Joins may practically involve more than three tables depending on the need
for information.
 If such joins are used very often, the performance of the database will become very
poor.
 In such cases, storing a few fields redundantly can be ignored to increase the
performance of the database.
 The databases that possess such minor redundancies in order to increase
performance are called denormalized databases and the process of doing so is
called denormalization.

More Related Content

Similar to week 7 normalization.pptx

Arrays and lists in sql server 2008
Arrays and lists in sql server 2008Arrays and lists in sql server 2008
Arrays and lists in sql server 2008
nxthuong
 
A
AA
uniT 4 (1).pptx
uniT 4 (1).pptxuniT 4 (1).pptx
uniT 4 (1).pptx
YashWaghmare27
 
1. What two conditions must be met before an entity can be classif.docx
1. What two conditions must be met before an entity can be classif.docx1. What two conditions must be met before an entity can be classif.docx
1. What two conditions must be met before an entity can be classif.docx
jackiewalcutt
 
SQL Query Interview Questions
SQL Query Interview QuestionsSQL Query Interview Questions
SQL Query Interview Questions
soniajessica2
 
Module 4_PART1.pptx
Module 4_PART1.pptxModule 4_PART1.pptx
Module 4_PART1.pptx
Haso12
 
Normalization.ppt What is Normalizations
Normalization.ppt What is NormalizationsNormalization.ppt What is Normalizations
Normalization.ppt What is Normalizations
SHAKIR325211
 
Merging data (1)
Merging data (1)Merging data (1)
Merging data (1)
Ris Fernandez
 
DataModeling.pptx
DataModeling.pptxDataModeling.pptx
DataModeling.pptx
GauravGarg215333
 
Vaastav talwar a010145020052 adbms psda vaastav talwar
Vaastav talwar a010145020052 adbms psda   vaastav talwarVaastav talwar a010145020052 adbms psda   vaastav talwar
Vaastav talwar a010145020052 adbms psda vaastav talwar
Shambhavi Vats
 
Instructions sc access_1a[1]
Instructions sc access_1a[1]Instructions sc access_1a[1]
Instructions sc access_1a[1]
gaaaaaaaasa
 
Resume
ResumeResume
Business Intelligence Portfolio 2003
Business Intelligence Portfolio 2003Business Intelligence Portfolio 2003
Business Intelligence Portfolio 2003
troylrockwell
 
Loughrey_Resume
Loughrey_ResumeLoughrey_Resume
Loughrey_Resume
Scott Loughrey
 
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MISDKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
DHANANJAY KUMAR
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
Praveen Kumar
 
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docxModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
adelaidefarmer322
 
Coit11237 assignment 2 specifications
Coit11237 assignment 2 specificationsCoit11237 assignment 2 specifications
Coit11237 assignment 2 specifications
Nicole Valerio
 
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docxPURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
amrit47
 
Sql (DBMS)
Sql (DBMS)Sql (DBMS)
Sql (DBMS)
Saransh Vijay
 

Similar to week 7 normalization.pptx (20)

Arrays and lists in sql server 2008
Arrays and lists in sql server 2008Arrays and lists in sql server 2008
Arrays and lists in sql server 2008
 
A
AA
A
 
uniT 4 (1).pptx
uniT 4 (1).pptxuniT 4 (1).pptx
uniT 4 (1).pptx
 
1. What two conditions must be met before an entity can be classif.docx
1. What two conditions must be met before an entity can be classif.docx1. What two conditions must be met before an entity can be classif.docx
1. What two conditions must be met before an entity can be classif.docx
 
SQL Query Interview Questions
SQL Query Interview QuestionsSQL Query Interview Questions
SQL Query Interview Questions
 
Module 4_PART1.pptx
Module 4_PART1.pptxModule 4_PART1.pptx
Module 4_PART1.pptx
 
Normalization.ppt What is Normalizations
Normalization.ppt What is NormalizationsNormalization.ppt What is Normalizations
Normalization.ppt What is Normalizations
 
Merging data (1)
Merging data (1)Merging data (1)
Merging data (1)
 
DataModeling.pptx
DataModeling.pptxDataModeling.pptx
DataModeling.pptx
 
Vaastav talwar a010145020052 adbms psda vaastav talwar
Vaastav talwar a010145020052 adbms psda   vaastav talwarVaastav talwar a010145020052 adbms psda   vaastav talwar
Vaastav talwar a010145020052 adbms psda vaastav talwar
 
Instructions sc access_1a[1]
Instructions sc access_1a[1]Instructions sc access_1a[1]
Instructions sc access_1a[1]
 
Resume
ResumeResume
Resume
 
Business Intelligence Portfolio 2003
Business Intelligence Portfolio 2003Business Intelligence Portfolio 2003
Business Intelligence Portfolio 2003
 
Loughrey_Resume
Loughrey_ResumeLoughrey_Resume
Loughrey_Resume
 
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MISDKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
DKUMAR-EXCEL WITH VBA+SQL-CV.doc@Having 3.5 Yr exp in MIS
 
Unit03 dbms
Unit03 dbmsUnit03 dbms
Unit03 dbms
 
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docxModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
ModuleWeek 5Homework AssignmentChapter 7 HomeworkPART 1.docx
 
Coit11237 assignment 2 specifications
Coit11237 assignment 2 specificationsCoit11237 assignment 2 specifications
Coit11237 assignment 2 specifications
 
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docxPURPOSE of the project is Williams Specialty Company (WSC) reque.docx
PURPOSE of the project is Williams Specialty Company (WSC) reque.docx
 
Sql (DBMS)
Sql (DBMS)Sql (DBMS)
Sql (DBMS)
 

Recently uploaded

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
adhitya5119
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
Amin Marwan
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Fajar Baskoro
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
MysoreMuleSoftMeetup
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
siemaillard
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
Krassimira Luka
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
Chevonnese Chevers Whyte, MBA, B.Sc.
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
dot55audits
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
สมใจ จันสุกสี
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
Nguyen Thanh Tu Collection
 
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
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
BoudhayanBhattachari
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 

Recently uploaded (20)

BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
Main Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docxMain Java[All of the Base Concepts}.docx
Main Java[All of the Base Concepts}.docx
 
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdfIGCSE Biology Chapter 14- Reproduction in Plants.pdf
IGCSE Biology Chapter 14- Reproduction in Plants.pdf
 
Pengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptxPengantar Penggunaan Flutter - Dart programming language1.pptx
Pengantar Penggunaan Flutter - Dart programming language1.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47Mule event processing models | MuleSoft Mysore Meetup #47
Mule event processing models | MuleSoft Mysore Meetup #47
 
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptxPrésentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
Présentationvvvvvvvvvvvvvvvvvvvvvvvvvvvv2.pptx
 
Temple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation resultsTemple of Asclepius in Thrace. Excavation results
Temple of Asclepius in Thrace. Excavation results
 
Constructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective CommunicationConstructing Your Course Container for Effective Communication
Constructing Your Course Container for Effective Communication
 
ZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptxZK on Polkadot zero knowledge proofs - sub0.pptx
ZK on Polkadot zero knowledge proofs - sub0.pptx
 
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
คำศัพท์ คำพื้นฐานการอ่าน ภาษาอังกฤษ ระดับชั้น ม.1
 
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
BÀI TẬP DẠY THÊM TIẾNG ANH LỚP 7 CẢ NĂM FRIENDS PLUS SÁCH CHÂN TRỜI SÁNG TẠO ...
 
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
 
B. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdfB. Ed Syllabus for babasaheb ambedkar education university.pdf
B. Ed Syllabus for babasaheb ambedkar education university.pdf
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 

week 7 normalization.pptx

  • 1. NORMALIZATION Instructor: Mehwashma Amir E-R Model and Normalization/ Session 2 1
  • 2. SQL Server 2012 © Aptech Ltd. SQL Server 2012 2 E-R Model and Normalization/ Session 2  Initially, all databases are characterized by large number of columns and records.  This approach has certain drawbacks.  The following table consist of details of the employees and the project they are working on. Repetition Anomaly  The data such as Project_id, Project_name, Grade, and Salary repeat many times.  This repetition hampers both, performance during retrieval of data and the storage capacity.  This repetition of data is called the repetition anomaly.
  • 3. SQL Server 2012 © Aptech Ltd. SQL Server 2012 3 E-R Model and Normalization/ Session 2  The repetition is shown in the following table with the help of shaded cells: Insertion Anomaly  Suppose the department recruits a new employee named Ann.  Consider that Ann has not been assigned any project. Insertion of her details in the table would leave columns Project_id and Project_name empty.  Leaving columns blank could lead to problems later.  Anomalies created by such insertions are called insertion anomalies as shown in the following table:
  • 4. SQL Server 2012 © Aptech Ltd. SQL Server 2012 4 E-R Model and Normalization/ Session 2 Deletion Anomaly  Suppose, Bob is relieved from the project MAGNUM.  Deleting the record deletes Bob's Emp_no, Grade, and Salary details too.  This loss of data is harmful as all of Bob's personal details are also lost.  This kind of loss of data due to deletion is called deletion anomaly as can be seen in the following table: Updating Anomaly  Suppose John was given a hike in Salary or John was demoted.  The change in John's Salary or Grade needs to be reflected in all projects John works for.  This problem in updating all the occurrences is called updating anomaly.
  • 5. SQL Server 2012 © Aptech Ltd. SQL Server 2012 5 E-R Model and Normalization/ Session 2 The Department Employee Details table is called an unnormalized table. These drawbacks lead to the need for normalization. Normalization is the process of removing unwanted redundancy and dependencies. Initially, Codd (1972) presented three normal forms (1NF, 2NF, and 3NF), all based on dependencies among the attributes of a relation. The fourth and fifth normal forms are based on multi value and join dependencies and were proposed later.
  • 6. SQL Server 2012 © Aptech Ltd. SQL Server 2012 6 E-R Model and Normalization/ Session 2 1 • Create separate tables for each group of related data. 2 • The table columns must have atomic values. 3 • All the key attributes must be identified.  In order to achieve the first normal form, following steps need to be performed:  Consider the Employee Project Details table as follows:  The table has data related to projects and employees.  The table needs to be split into two tables, that is, a Project Details table and an Employee Details table.  The table columns, Project_id and Project_names, have multiple values.
  • 7. SQL Server 2012 © Aptech Ltd. SQL Server 2012 7 E-R Model and Normalization/ Session 2  The data needs to be split over different rows.  The resultant tables are Project Details and Employee Details as follows: Project Details Employee Details  The Project_id attribute is the primary key for the Project Details table.  The Emp_no attribute is the primary key for the Employee Details table.  Therefore, in first normal form, the initial Employee Project Details table has been reduced to the Project Details and Employee Details tables.
  • 8. SQL Server 2012 © Aptech Ltd. SQL Server 2012 8 E-R Model and Normalization/ Session 2  The tables are said to be in second normal form if:  Partial dependency means a non-key attribute should not be partially dependent on more than one key attribute.  The Project Details and Employee Details tables do not exhibit any partial dependencies.  The Project_name is dependent only on Project_id and Emp_name, Grade, and Salary are dependant only on Emp_no.  The tables also need to be related through foreign keys.  A third table, named Employee Project Details, is created with only two columns, Project_id and Emp_no. They meet the requirements of the first normal form. There are no partial dependencies in the tables. The tables are related through foreign keys.
  • 9. SQL Server 2012 © Aptech Ltd. SQL Server 2012 9 E-R Model and Normalization/ Session 2  So, the project and employee details tables on conversion to second normal form generates tables Project Details, Employee Details, and Employee Project Details as follows: Project Details Employee Project Details Employee Details  The attributes, Emp_no and Project_id, of the Employee Project Details table combine together to form the primary key.  Such primary keys are called composite primary keys.
  • 10. SQL Server 2012 © Aptech Ltd. SQL Server 2012 10 E-R Model and Normalization/ Session 2  To achieve the third normal form: The tables should meet the requirements of the second normal form The tables should not have transitive dependencies in them  The Project Details, Employee Details, and Employee Project Details tables are in second normal form.  If an attribute can be determined by another non-key attribute, it is called a transitive dependency.  That is, every non-key attribute should be determined by the key attribute only.  If a non-key attribute can be determined by another non-key attribute, it needs to put into another table.
  • 11. SQL Server 2012 © Aptech Ltd. SQL Server 2012 11 E-R Model and Normalization/ Session 2  On observing the different tables, it is seen that the Project Details and Employee Project Details tables do not exhibit any such transitive dependencies.  The non-key attributes are totally determined by the key attributes.  Project_name is only determined by Project_number.  On further scrutinizing the Employee Details table, a certain inconsistency is seen.  The attribute Salary is determined by the attribute Grade and not the key attribute Emp_no.  Thus, this transitive dependency needs to be removed.  The Employee Details table can be split into Employee Details and Grade Salary Details tables as follows: Employee Details Grade Salary Details
  • 12. SQL Server 2012 © Aptech Ltd. SQL Server 2012 12 E-R Model and Normalization/ Session 2  Thus, at the end of the three normalization stages, the initial Employee Project Details table has been reduced to the Project Details, Employee Project Details, Employee Details, and Grade Salary Details tables as follows: Employee Details Grade Salary Details Project Details Employee Project Details
  • 13. SQL Server 2012 © Aptech Ltd. SQL Server 2012 13 E-R Model and Normalization/ Session 2 By normalizing a database, redundancy is reduced. This, in turn, reduces the storage requirements for the database and ensures data integrity. However, it has following drawbacks: Complex join queries may have to be written often to combine the data in multiple tables. Joins may practically involve more than three tables depending on the need for information.  If such joins are used very often, the performance of the database will become very poor.  In such cases, storing a few fields redundantly can be ignored to increase the performance of the database.  The databases that possess such minor redundancies in order to increase performance are called denormalized databases and the process of doing so is called denormalization.