SlideShare a Scribd company logo
NORMALIZATION
Sadik & Shruti
AGENDA
Functional Dependency
Armstrong axioms & Inference rules
​Normalization
Functional Dependency: 3
The functional dependency is a relationship that exist between two
attributes. It typically exists between the primary key and non-key attribute
within a table.
The left side of FD is known as a determinant, and
The right side of the production is known as a dependent
X → 𝑌
Determinant
Dependent
Types of Functional Dependency:
4
Trivial FD
Non-Trivial FD
Multivalued FD
Transitive FD
5
Trivial Functional Dependency
If 𝐴 → 𝐵 is a Functional Dependency and ‘B’ is a subset of ‘A’ then
this FD is called as Trivial Functional Dependency.
Example
S_roll S_name age
3 a 20
4 b 19
5 c 20
Here, {S_roll, S_name} → S_name is a trivial FD, since name is a subset of
{S_roll, S_name}.
S_roll → S_roll is also trivial FD
• AB→A
• A → A
6
Non-Trivial Functional
Dependency
In Non-trivial FD, the dependent is strictly not a subset of the
determinant.
i.e. If X→ Y and Y is not a subset of X, then it is called Non-trivial
FD
Example S_roll S_name age
3 a 20
4 b 19
5 c 20
Here, S_roll→ S_name is Non-trivial FD, since name is not a subset of S_roll.
{S_roll, S_name} → age is also Non-trivial FD
• A→B
• AB→ C
7
Multivalued Functional
Dependency
• In Multivalued functional dependency, entities of dependent set
are not dependent on each other.
• When two attributes in a table are independent of one another
but both rely on a third attribute, this is known as multivalued
dependency.
• A multivalued dependency includes at least three attributes since
it consists of at least two attributes that are based on a third
attribute.
• It is represented by double arrow: →→
• For example: P→→ Q
P →→ R
8
Multivalued Functional
Dependency
Example S_name Course Activities
A Mathematics Singing
A Mathematics Dancing
B Computer Cricket
C Literature Dancing
C Literature Cricket
C Literature Singing
In the above table, we can see Students A and C have interest in more than one activity.
This is multivalued dependency because Course of a student are independent of Activities but
are dependent of the student.
Therefore multivalued dependency:
S_name → Course
S_name → Activities
9
Transitive Functional Dependency
• In transitive functional dependency, dependent is indirectly
dependent on determinant
• i.e. If A→B & B→C, then according to axiom of transitivity, A→C.
This is a transitive functional dependency
Example Roll_no Name Dept Dept_loc
1 A CSE SB1
2 B ECE SB1
3 C IT SB2
4 D EEE SB3
Here, Roll_no → Dept and Dept →Dept_loc
Hence, according to the axiom of transitivity, Roll_no → Dept_loc is a valid functional
dependency.
10
Armstrong’s Axioms in FD
These are the rules to find logically implied functional
dependencies.
W, X, Y, Z some attribute set over R.
1. Reflexivity:
In the reflexive rule, if Y is a subset of X, then X determines Y.
if Y ⊆ X then X → Y.
2. Transitivity:
In the transitive rule, if X determines Y and Y determines Z, then
X
must also determine Z.
if X → Y and Y → Z then X → Z
3. Augmentation:
In augmentation, If X determines Y, then XZ determines YZ for
any
Z.
11
Armstrong’s Axioms in FD
Secondary Rules-
These rules can be derived from the above axioms.
1. Union Rule:
If A →B holds and A → C holds, then A → BC holds.
2. Composition:
If X → Y and P → Q then XP → YQ always true.
3. Decomposition:
If X →YZ is a FD then X →Y and X →Z always true.
4. Pseudo transitive Rule:
If X →Y and YZ → P are two FDs then XZ → P is always true.
12
Normalization
Normalization is a process of organizing the data in database to avoid:
i. Data redundancy
ii. Insertion anomaly
iii. Update anomaly
iv. Deletion anomaly
13
Data redundancy in DBMS
Redundancy in DBMS is the problem that arises when the database is
not normalized. It is the concept of storing multiple copies of the same
data in different parts of the database.
Example
student_id student_name student_age dept_id dept_name dept_head
1 A 18 100
Computer
Science
F1
2 B 18 100
Computer
Science
F1
In this student table, we have repeated the same department details,
dept_id, dept_name, and dept_head in every student record. This
causes redundancy in the student table.
14
Insertion Anomaly in
DBMS
The term ‘insertion anomaly’ is used to describe when a new row is
added to a table and it causes an inconsistency.
Example
S_id S_name C_id C_name Fac_id Fac_name Fac_sal.
1 A C1 DBMS F1 Bob 40K
2 B C2 C++ F2 Doe 30K
3 C C1 DBMS F1 Bob 40K
4 D C1 DBMS F1 Bob 40K
In this table S_id is PK. Suppose, we want to add a student in this table
it will not give any error but if we add new course or faculty then error
occur.
Because, S_id is empty for this case. This is Insertion Anomaly.
15
Update Anomaly in DBMS
If there are some changes in the database, we have to apply that
change in all the rows. And if we miss any row, we will have one more
field, creating an update anomaly in the database.
Example
S_id S_name C_id C_name Fac_id Fac_name Fac_sal.
1 A C1 DBMS F1 Bob 40K
2 B C2 C++ F2 Doe 30K
3 C C1 DBMS F1 Bob 40K
4 D C1 DBMS F1 Bob 40K
5 E C3 Java F1 Bob 40K
In the given table, we have two rows for a faculty named Bob, and he
taught two different courses. If we need to update Bob’s salary, we must
update the same in all rows. Otherwise, the data will become
inconsistent.
16
Normal Forms in DBMS
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
Fourth Normal Form (4NF)
Fifth Normal Form (5NF)
17
First Normal Form (1NF)
For a table to be in the First Normal Form, it should follow the following 4 rules:
1. Values stored in a column should be of the same domain
2. All the columns in a table should have unique names.
3. It should only have single valued attributes/columns.
4. And the order in which data is stored, does not matter.
5. After converting ER model into relational model, all the relations are in 1st
Normal form.
EXAMPLE:
Relation Employee is not in 1NF because of multi-valued attribute e_ph
E_id E_name E_ph E_state
14 John
7728263853,
9062978898
WB
20 Harry 9088989763 Bihar
11 Tony
6291359760,
9800146215
Punjab
18
First Normal Form (1NF)
Decomposed Relations:
Now ‘Employee’ Table would be decomposed as given below:
Solution 1
E_id E_name E_ph E_state
14 John 7728263853 WB
14 John 9062978898 WB
20 Harry 9088989763 Bihar
11 Tony 6291359760 Punjab
11 Tony 9800146215 Punjab
Solution 2
E_id
E_nam
e
E_ph1 E_ph2 E_state
14 John 7728263853 9062978898 WB
20 Harry 9088989763 - Bihar
11 Tony 6291359760 9800146215 Punjab
Solution 3
E_id E_name E_state
14 John WB
20 Harry Bihar
11 Tony Punjab
Solution 3
E_id E_ph
14
772826385
3
14
906297889
8
20
908898976
3
19
Second Normal Form (2NF)
• In the 2NF, relation must be in 1NF
• In the second normal form, all non-key attributes are fully functional dependent
on the primary key.
• There should be non Partial dependency.
EXAMPLE:
Let's assume, a school can store the data of teachers and the subjects they teach.
In a school, a teacher can teach more than one subject.
TEACHER_ID SUBJECT TEACHER_AGE
25 Chemistry 30
25 Biology 30
47 English 35
83 Math 38
83 Computer 38
20
Second Normal Form (2NF)
In the given table {TEACHER_ID, SUBJECT} is primary key.
Non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a
proper subset of a candidate key. That’s why it violates the rule for 2NF.
To convert it into 2NF, we decompose it into two tables.
TEACHER_ID TEACHER_AGE
25 30
47 35
83 38
TEACHER_ID SUBJECT
25 Chemistry
25 Biology
47 English
83 Math
83 Computer
21
Third Normal Form (3NF)
A relation is in third normal form, if there is no transitive dependency for non-prime
attributes as well as it is in second normal form.
A relation is in 3NF if at least one of the following condition holds in every non-trivial
function dependency X → Y
• X is a super key.
• Y is a prime attribute (each element of Y is part of some candidate key).
STUD_NO STUD_NAME STUD_STATE STUD_COUNTRY STUD_AGE
1 A Punjab India 20
2 B WB India 20
3 C WB India 21
In relation STUDENT
FD set: {STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE ->
STUD_COUNTRY, STUD_NO -> STUD_AGE}
Candidate Key: {STUD_NO}
22
Third Normal Form (3NF)
For this relation, STUD_NO -> STUD_STATE and STUD_STATE ->
STUD_COUNTRY are true. So STUD_COUNTRY is transitively dependent on
STUD_NO. It violates the third normal form.
To convert it in third normal form, we will decompose the relation as:
STUD_NO STUD_NAME STUD_STATE STUD_AGE
1 A Punjab 20
2 B WB 20
3 C WB 21
STUD_STATE STUD_COUNTRY
Punjab India
WB India
23
Boyce Codd Normal Form
A Relation Scheme ‘R’ is in BCNF if it is in 3NF and for every dependency X→Y, the
determinant must be a super key.
EMP_ID EMP_COUNTRY EMP_DEPT DEPT_TYPE EMP_DEPT_NO
264 India Designing D394 283
264 India Testing D394 300
364 UK Stores D283 232
364 UK Developing D283 549
In the above table Functional dependencies are as follows:
EMP_ID → EMP_COUNTRY
EMP_DEPT → {DEPT_TYPE, EMP_DEPT_NO}
Candidate key: {EMP-ID, EMP-DEPT}
24
Boyce Codd Normal Form
Candidate key: {EMP-ID, EMP-DEPT}
The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys.
To convert the given table into BCNF, we decompose it into three tables:
EMP_COUNTRY
EMP_ID EMP_COUNTRY
264 India
264 India
EMP_DEPT
EMP_DEPT DEPT_TYPE EMP_DEPT_NO
Designing D394 283
Testing D394 300
Stores D283 232
Developing D283 549
EMP_DEPT_MAP
EMP_ID EMP_DEP
T
D394 283
D394 300
D283 232
D283 549
25
Fourth Normal Form (4NF)
A relation will be in 4NF if it is in BCNF and has no multi-valued dependency.
STU_ID COURSE HOBBY
21 Computer Dancing
21 Math Singing
34 Chemistry Dancing
74 Biology Cricket
59 Physics Hockey
The given STUDENT table is in 3NF, but the COURSE and HOBBY are two independent entity.
Hence, there is no relationship between COURSE and HOBBY.
In the STUDENT relation, a student with STU_ID, 21 contains two courses, Computer and Math and
two hobbies, Dancing and Singing. So there is a Multi-valued dependency on STU_ID, which leads
to unnecessary repetition of data.
26
Fourth Normal Form (4NF)
So to make the above table into 4NF, we can decompose it into two tables:
STUDENT_COURSE
STU_ID COURSE
21 Computer
21 Math
34 Chemistry
59 Physics
STUDENT_HOBBY
STU_ID HOBBY
21 Dancing
21 Singing
34 Dancing
59 Hockey
27
Fifth Normal Form (5NF)
• A relation is in 5NF if it is in 4NF and not contains any join dependency and
joining should be lossless.
• 5NF is satisfied when all the tables are broken into as many tables as possible in
order to avoid redundancy.
• 5NF is also known as Project-join normal form (PJ/NF).
SUBJECT LECTURER SEMESTER
Computer Anshika Semester 1
Computer John Semester 1
Math John Semester 1
Math Akash Semester 2
Chemistry Praveen Semester 1
28
Fifth Normal Form (5NF)
• In the above table, John takes both Computer and Math class for Semester 1 but
he doesn't take Math class for Semester 2. In this case, combination of all these
fields required to identify a valid data.
• Suppose we add a new Semester as Semester 3 but do not know about the
subject and who will be taking that subject so we leave Lecturer and Subject as
NULL. But all three columns together acts as a primary key, so we can't leave
other two columns blank.
• So to make the above table into 5NF, we can decompose it into three relations
P1, P2 & P3:
29
Fifth Normal Form (5NF)
SUBJECT LECTURER SEMESTER
Computer Anshika Semester 1
Computer John Semester 1
Math John Semester 1
Math Akash Semester 2
Chemistry Praveen Semester 1
SEMESTER SUBJECT
Semester 1 Computer
Semester 1 Math
Semester 1 Chemistry
Semester 2 Math
SUBJECT LECTURER
Computer Anshika
Computer John
Math John
Math Akash
Chemistry Praveen
SEMSTER LECTURER
Semester 1 Anshika
Semester 1 John
Semester 2 Akash
Semester 1 Praveen

More Related Content

Similar to normalization ppt.pptx

Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Pyingkodi Maran
 
Database normalization
Database normalizationDatabase normalization
Database normalizationJignesh Jain
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
Zoha681526
 
Database normalization
Database normalizationDatabase normalization
Database normalization
VARSHAKUMARI49
 
Normalization in Database Management System.pptx
Normalization in Database Management System.pptxNormalization in Database Management System.pptx
Normalization in Database Management System.pptx
Roshni814224
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
Deependra35
 
Chapter-8 Relational Database Design
Chapter-8 Relational Database DesignChapter-8 Relational Database Design
Chapter-8 Relational Database Design
Kunal Anand
 
Types of normalization
Types of normalizationTypes of normalization
Types of normalization
PratibhaRashmiSingh
 
Normalization
NormalizationNormalization
Normalization
Mohd Mastana
 
Relational database
Relational  databaseRelational  database
Relational database
amkrisha
 
Data normalization
Data normalizationData normalization
Relational Database design.pptx
Relational Database design.pptxRelational Database design.pptx
Relational Database design.pptx
johndoe193402
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
Drishti Bhalla
 
Normalization
NormalizationNormalization
Normalization
Ramesh 4
 
FD.pdf
FD.pdfFD.pdf
FD.pdf
BijayNag1
 
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
Harsh Parmar
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
ranjithagharsamy
 

Similar to normalization ppt.pptx (20)

Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
normalization
normalizationnormalization
normalization
 
09.01 normalization
09.01 normalization09.01 normalization
09.01 normalization
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Normalization and three normal forms.pptx
Normalization and three normal forms.pptxNormalization and three normal forms.pptx
Normalization and three normal forms.pptx
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Normalization in Database Management System.pptx
Normalization in Database Management System.pptxNormalization in Database Management System.pptx
Normalization in Database Management System.pptx
 
Normmmalizzarion.ppt
Normmmalizzarion.pptNormmmalizzarion.ppt
Normmmalizzarion.ppt
 
Chapter-8 Relational Database Design
Chapter-8 Relational Database DesignChapter-8 Relational Database Design
Chapter-8 Relational Database Design
 
Types of normalization
Types of normalizationTypes of normalization
Types of normalization
 
Normalization
NormalizationNormalization
Normalization
 
Relational database
Relational  databaseRelational  database
Relational database
 
Data normalization
Data normalizationData normalization
Data normalization
 
Relational Database design.pptx
Relational Database design.pptxRelational Database design.pptx
Relational Database design.pptx
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
FD.pdf
FD.pdfFD.pdf
FD.pdf
 
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
Normalization,1st NF, 2nd NF, 3rd NF, BCNF, 4th NF, 5th NF
 
Chapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptxChapter 3 ( PART 2 ).pptx
Chapter 3 ( PART 2 ).pptx
 

Recently uploaded

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
seandesed
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
abh.arya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
AafreenAbuthahir2
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation & Control
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
MLILAB
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
bakpo1
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
Intella Parts
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
DuvanRamosGarzon1
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
ankuprajapati0525
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
gerogepatton
 

Recently uploaded (20)

Architectural Portfolio Sean Lockwood
Architectural Portfolio Sean LockwoodArchitectural Portfolio Sean Lockwood
Architectural Portfolio Sean Lockwood
 
Democratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek AryaDemocratizing Fuzzing at Scale by Abhishek Arya
Democratizing Fuzzing at Scale by Abhishek Arya
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234WATER CRISIS and its solutions-pptx 1234
WATER CRISIS and its solutions-pptx 1234
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
Water Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdfWater Industry Process Automation and Control Monthly - May 2024.pdf
Water Industry Process Automation and Control Monthly - May 2024.pdf
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
H.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdfH.Seo,  ICLR 2024, MLILAB,  KAIST AI.pdf
H.Seo, ICLR 2024, MLILAB, KAIST AI.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang,  ICLR 2024, MLILAB, KAIST AI.pdfJ.Yang,  ICLR 2024, MLILAB, KAIST AI.pdf
J.Yang, ICLR 2024, MLILAB, KAIST AI.pdf
 
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
一比一原版(SFU毕业证)西蒙菲莎大学毕业证成绩单如何办理
 
Forklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella PartsForklift Classes Overview by Intella Parts
Forklift Classes Overview by Intella Parts
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSETECHNICAL TRAINING MANUAL   GENERAL FAMILIARIZATION COURSE
TECHNICAL TRAINING MANUAL GENERAL FAMILIARIZATION COURSE
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
The role of big data in decision making.
The role of big data in decision making.The role of big data in decision making.
The role of big data in decision making.
 
Immunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary AttacksImmunizing Image Classifiers Against Localized Adversary Attacks
Immunizing Image Classifiers Against Localized Adversary Attacks
 

normalization ppt.pptx

  • 2. AGENDA Functional Dependency Armstrong axioms & Inference rules ​Normalization
  • 3. Functional Dependency: 3 The functional dependency is a relationship that exist between two attributes. It typically exists between the primary key and non-key attribute within a table. The left side of FD is known as a determinant, and The right side of the production is known as a dependent X → 𝑌 Determinant Dependent
  • 4. Types of Functional Dependency: 4 Trivial FD Non-Trivial FD Multivalued FD Transitive FD
  • 5. 5 Trivial Functional Dependency If 𝐴 → 𝐵 is a Functional Dependency and ‘B’ is a subset of ‘A’ then this FD is called as Trivial Functional Dependency. Example S_roll S_name age 3 a 20 4 b 19 5 c 20 Here, {S_roll, S_name} → S_name is a trivial FD, since name is a subset of {S_roll, S_name}. S_roll → S_roll is also trivial FD • AB→A • A → A
  • 6. 6 Non-Trivial Functional Dependency In Non-trivial FD, the dependent is strictly not a subset of the determinant. i.e. If X→ Y and Y is not a subset of X, then it is called Non-trivial FD Example S_roll S_name age 3 a 20 4 b 19 5 c 20 Here, S_roll→ S_name is Non-trivial FD, since name is not a subset of S_roll. {S_roll, S_name} → age is also Non-trivial FD • A→B • AB→ C
  • 7. 7 Multivalued Functional Dependency • In Multivalued functional dependency, entities of dependent set are not dependent on each other. • When two attributes in a table are independent of one another but both rely on a third attribute, this is known as multivalued dependency. • A multivalued dependency includes at least three attributes since it consists of at least two attributes that are based on a third attribute. • It is represented by double arrow: →→ • For example: P→→ Q P →→ R
  • 8. 8 Multivalued Functional Dependency Example S_name Course Activities A Mathematics Singing A Mathematics Dancing B Computer Cricket C Literature Dancing C Literature Cricket C Literature Singing In the above table, we can see Students A and C have interest in more than one activity. This is multivalued dependency because Course of a student are independent of Activities but are dependent of the student. Therefore multivalued dependency: S_name → Course S_name → Activities
  • 9. 9 Transitive Functional Dependency • In transitive functional dependency, dependent is indirectly dependent on determinant • i.e. If A→B & B→C, then according to axiom of transitivity, A→C. This is a transitive functional dependency Example Roll_no Name Dept Dept_loc 1 A CSE SB1 2 B ECE SB1 3 C IT SB2 4 D EEE SB3 Here, Roll_no → Dept and Dept →Dept_loc Hence, according to the axiom of transitivity, Roll_no → Dept_loc is a valid functional dependency.
  • 10. 10 Armstrong’s Axioms in FD These are the rules to find logically implied functional dependencies. W, X, Y, Z some attribute set over R. 1. Reflexivity: In the reflexive rule, if Y is a subset of X, then X determines Y. if Y ⊆ X then X → Y. 2. Transitivity: In the transitive rule, if X determines Y and Y determines Z, then X must also determine Z. if X → Y and Y → Z then X → Z 3. Augmentation: In augmentation, If X determines Y, then XZ determines YZ for any Z.
  • 11. 11 Armstrong’s Axioms in FD Secondary Rules- These rules can be derived from the above axioms. 1. Union Rule: If A →B holds and A → C holds, then A → BC holds. 2. Composition: If X → Y and P → Q then XP → YQ always true. 3. Decomposition: If X →YZ is a FD then X →Y and X →Z always true. 4. Pseudo transitive Rule: If X →Y and YZ → P are two FDs then XZ → P is always true.
  • 12. 12 Normalization Normalization is a process of organizing the data in database to avoid: i. Data redundancy ii. Insertion anomaly iii. Update anomaly iv. Deletion anomaly
  • 13. 13 Data redundancy in DBMS Redundancy in DBMS is the problem that arises when the database is not normalized. It is the concept of storing multiple copies of the same data in different parts of the database. Example student_id student_name student_age dept_id dept_name dept_head 1 A 18 100 Computer Science F1 2 B 18 100 Computer Science F1 In this student table, we have repeated the same department details, dept_id, dept_name, and dept_head in every student record. This causes redundancy in the student table.
  • 14. 14 Insertion Anomaly in DBMS The term ‘insertion anomaly’ is used to describe when a new row is added to a table and it causes an inconsistency. Example S_id S_name C_id C_name Fac_id Fac_name Fac_sal. 1 A C1 DBMS F1 Bob 40K 2 B C2 C++ F2 Doe 30K 3 C C1 DBMS F1 Bob 40K 4 D C1 DBMS F1 Bob 40K In this table S_id is PK. Suppose, we want to add a student in this table it will not give any error but if we add new course or faculty then error occur. Because, S_id is empty for this case. This is Insertion Anomaly.
  • 15. 15 Update Anomaly in DBMS If there are some changes in the database, we have to apply that change in all the rows. And if we miss any row, we will have one more field, creating an update anomaly in the database. Example S_id S_name C_id C_name Fac_id Fac_name Fac_sal. 1 A C1 DBMS F1 Bob 40K 2 B C2 C++ F2 Doe 30K 3 C C1 DBMS F1 Bob 40K 4 D C1 DBMS F1 Bob 40K 5 E C3 Java F1 Bob 40K In the given table, we have two rows for a faculty named Bob, and he taught two different courses. If we need to update Bob’s salary, we must update the same in all rows. Otherwise, the data will become inconsistent.
  • 16. 16 Normal Forms in DBMS First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF) Fourth Normal Form (4NF) Fifth Normal Form (5NF)
  • 17. 17 First Normal Form (1NF) For a table to be in the First Normal Form, it should follow the following 4 rules: 1. Values stored in a column should be of the same domain 2. All the columns in a table should have unique names. 3. It should only have single valued attributes/columns. 4. And the order in which data is stored, does not matter. 5. After converting ER model into relational model, all the relations are in 1st Normal form. EXAMPLE: Relation Employee is not in 1NF because of multi-valued attribute e_ph E_id E_name E_ph E_state 14 John 7728263853, 9062978898 WB 20 Harry 9088989763 Bihar 11 Tony 6291359760, 9800146215 Punjab
  • 18. 18 First Normal Form (1NF) Decomposed Relations: Now ‘Employee’ Table would be decomposed as given below: Solution 1 E_id E_name E_ph E_state 14 John 7728263853 WB 14 John 9062978898 WB 20 Harry 9088989763 Bihar 11 Tony 6291359760 Punjab 11 Tony 9800146215 Punjab Solution 2 E_id E_nam e E_ph1 E_ph2 E_state 14 John 7728263853 9062978898 WB 20 Harry 9088989763 - Bihar 11 Tony 6291359760 9800146215 Punjab Solution 3 E_id E_name E_state 14 John WB 20 Harry Bihar 11 Tony Punjab Solution 3 E_id E_ph 14 772826385 3 14 906297889 8 20 908898976 3
  • 19. 19 Second Normal Form (2NF) • In the 2NF, relation must be in 1NF • In the second normal form, all non-key attributes are fully functional dependent on the primary key. • There should be non Partial dependency. EXAMPLE: Let's assume, a school can store the data of teachers and the subjects they teach. In a school, a teacher can teach more than one subject. TEACHER_ID SUBJECT TEACHER_AGE 25 Chemistry 30 25 Biology 30 47 English 35 83 Math 38 83 Computer 38
  • 20. 20 Second Normal Form (2NF) In the given table {TEACHER_ID, SUBJECT} is primary key. Non-prime attribute TEACHER_AGE is dependent on TEACHER_ID which is a proper subset of a candidate key. That’s why it violates the rule for 2NF. To convert it into 2NF, we decompose it into two tables. TEACHER_ID TEACHER_AGE 25 30 47 35 83 38 TEACHER_ID SUBJECT 25 Chemistry 25 Biology 47 English 83 Math 83 Computer
  • 21. 21 Third Normal Form (3NF) A relation is in third normal form, if there is no transitive dependency for non-prime attributes as well as it is in second normal form. A relation is in 3NF if at least one of the following condition holds in every non-trivial function dependency X → Y • X is a super key. • Y is a prime attribute (each element of Y is part of some candidate key). STUD_NO STUD_NAME STUD_STATE STUD_COUNTRY STUD_AGE 1 A Punjab India 20 2 B WB India 20 3 C WB India 21 In relation STUDENT FD set: {STUD_NO -> STUD_NAME, STUD_NO -> STUD_STATE, STUD_STATE -> STUD_COUNTRY, STUD_NO -> STUD_AGE} Candidate Key: {STUD_NO}
  • 22. 22 Third Normal Form (3NF) For this relation, STUD_NO -> STUD_STATE and STUD_STATE -> STUD_COUNTRY are true. So STUD_COUNTRY is transitively dependent on STUD_NO. It violates the third normal form. To convert it in third normal form, we will decompose the relation as: STUD_NO STUD_NAME STUD_STATE STUD_AGE 1 A Punjab 20 2 B WB 20 3 C WB 21 STUD_STATE STUD_COUNTRY Punjab India WB India
  • 23. 23 Boyce Codd Normal Form A Relation Scheme ‘R’ is in BCNF if it is in 3NF and for every dependency X→Y, the determinant must be a super key. EMP_ID EMP_COUNTRY EMP_DEPT DEPT_TYPE EMP_DEPT_NO 264 India Designing D394 283 264 India Testing D394 300 364 UK Stores D283 232 364 UK Developing D283 549 In the above table Functional dependencies are as follows: EMP_ID → EMP_COUNTRY EMP_DEPT → {DEPT_TYPE, EMP_DEPT_NO} Candidate key: {EMP-ID, EMP-DEPT}
  • 24. 24 Boyce Codd Normal Form Candidate key: {EMP-ID, EMP-DEPT} The table is not in BCNF because neither EMP_DEPT nor EMP_ID alone are keys. To convert the given table into BCNF, we decompose it into three tables: EMP_COUNTRY EMP_ID EMP_COUNTRY 264 India 264 India EMP_DEPT EMP_DEPT DEPT_TYPE EMP_DEPT_NO Designing D394 283 Testing D394 300 Stores D283 232 Developing D283 549 EMP_DEPT_MAP EMP_ID EMP_DEP T D394 283 D394 300 D283 232 D283 549
  • 25. 25 Fourth Normal Form (4NF) A relation will be in 4NF if it is in BCNF and has no multi-valued dependency. STU_ID COURSE HOBBY 21 Computer Dancing 21 Math Singing 34 Chemistry Dancing 74 Biology Cricket 59 Physics Hockey The given STUDENT table is in 3NF, but the COURSE and HOBBY are two independent entity. Hence, there is no relationship between COURSE and HOBBY. In the STUDENT relation, a student with STU_ID, 21 contains two courses, Computer and Math and two hobbies, Dancing and Singing. So there is a Multi-valued dependency on STU_ID, which leads to unnecessary repetition of data.
  • 26. 26 Fourth Normal Form (4NF) So to make the above table into 4NF, we can decompose it into two tables: STUDENT_COURSE STU_ID COURSE 21 Computer 21 Math 34 Chemistry 59 Physics STUDENT_HOBBY STU_ID HOBBY 21 Dancing 21 Singing 34 Dancing 59 Hockey
  • 27. 27 Fifth Normal Form (5NF) • A relation is in 5NF if it is in 4NF and not contains any join dependency and joining should be lossless. • 5NF is satisfied when all the tables are broken into as many tables as possible in order to avoid redundancy. • 5NF is also known as Project-join normal form (PJ/NF). SUBJECT LECTURER SEMESTER Computer Anshika Semester 1 Computer John Semester 1 Math John Semester 1 Math Akash Semester 2 Chemistry Praveen Semester 1
  • 28. 28 Fifth Normal Form (5NF) • In the above table, John takes both Computer and Math class for Semester 1 but he doesn't take Math class for Semester 2. In this case, combination of all these fields required to identify a valid data. • Suppose we add a new Semester as Semester 3 but do not know about the subject and who will be taking that subject so we leave Lecturer and Subject as NULL. But all three columns together acts as a primary key, so we can't leave other two columns blank. • So to make the above table into 5NF, we can decompose it into three relations P1, P2 & P3:
  • 29. 29 Fifth Normal Form (5NF) SUBJECT LECTURER SEMESTER Computer Anshika Semester 1 Computer John Semester 1 Math John Semester 1 Math Akash Semester 2 Chemistry Praveen Semester 1 SEMESTER SUBJECT Semester 1 Computer Semester 1 Math Semester 1 Chemistry Semester 2 Math SUBJECT LECTURER Computer Anshika Computer John Math John Math Akash Chemistry Praveen SEMSTER LECTURER Semester 1 Anshika Semester 1 John Semester 2 Akash Semester 1 Praveen