SlideShare a Scribd company logo
Normalization
Presenting by:
1. Muzamil Raza
03087311722
what is Normalization?
• The process of producing a simpler and more
reliable database structure is called
normalization.
• We can only produce a simpler and more
reliable database structure by eliminate
redundancy from the database structure.
• Redundancy means duplication of data in
multiple files
• Many problems can be occur in DB structure
because of Redundancy.
Purposes of Normalization
1. It makes the database design efficient in performance.
2. It reduces the amount of data if possible.
3. It makes the database design free of update, insertion and deletion
anomalies/problems.
4. It makes the design according the rules of relational databases.
5. It identifies relationship b/w entities.
6. It makes a design that allows simple retrieval of data.
7. It simplifies data maintenance and reduces the need to restructure data.
Characteristics of Normalized Database
1. Each relation must have a key field.
2. All fields must contain atomic data.
3. There must be no repeating fields.
4. Each table must contain information about a single entity.
5. Each field in a relation must depend on key fields.
6. All non-key fields must be mutually independent.
Data Sources
Users
User’s Requirement
Specification
Sources like Data
dictionary & Model
Un-normalized Form (UNF)
First Normal Form (1NF)
Second Normal Form (2NF)
Third Normal Form (3NF)
Boyce-Codd Normal Form (BCNF)
Fourth Normal Form (4NF)
Normal Form (NF)
Fifth Normal Form (5NF)
Transfer attributes into Table Format
Remove Partial Dependencies
Remove Repeating Groups
Remove Transitive Dependencies
Make sure every determinate is candidate key
Remove Multi-Valued Dependencies
Remove Join Dependencies
Normalization
stop
Functional Dependency
• Functional dependency is a relationship between
attributes.
• It means that if the value of one attribute is known, it is
possible to obtain the value of another attribute.
• Sign of FD is “->”, The attribute on the left side of the sign
known as Determinate.
Suppose there is a table name student as bellow
Std-Roll.No Reg.No Name Address
1 Adp001 Muzamil Khanewal
2 Adp002 Manzar Kabierwalw
3 Adp003 Muzamil Khanewal
4 Adp004 Sheraz khanewal
If I say that
Address Name valid/Not-v
Exercise
Std-Roll.No Reg.No Name Address
1 Adp001 Muzamil Khanewal
2 Adp002 Manzar Kabierwala
3 Adp003 Muzamil Khanewal
4 Adp004 Sheraz kahanewal
If I say that
Name Address valid/Not-v
If I say that
Std-Roll.No Name valid/Not-v
If I say that
Reg.No Address valid/Not-v
1
2
3
Types of Functional Dependency
1. Trivalent: The dependency of an attribute on a set of attribute is
known as trivalent functional dependency attribute if the set of
attribute include that attribute.
(we have no new information)
In this table we assigned supposed names to the attributes.
Std-Roll.No (I) Reg.No (R) Name (N) Address (A)
1 Adp001 Muzamil Khanewal
2 Adp002 Manzar Kabierwala
3 Adp003 Muzamil Khanewal
4 Adp004 Sheraz kahanewal
If I say that
IN N Trivalent FD
In first case
If I say that
IN INA Non-Trivalent FD
In second case
R RINA Finding new
stop
Non-Trivalent FD Exercise
Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C)
1 Adp001 Muzamil Khanewal ADPcs
2 Adp002 Manzar Kabierwala ADPcs
3 Adp003 Muzamil Khanewal ADPcs
4 Adp004 Sheraz kahanewal ADPcs
Case 3
I RC valid/Not-v
Case 1
IR NA valid/Not-v
Case 4
IR NAC valid/Not-v
Case 5
N AC valid/Not-v
Case 6
NA I valid/Not-v
Case 2
R IC valid/Not-v
Closure set of attribute
• Before go to normalization we should know the entire set of
dependencies, and we can compute it only because of closure set of
attribute.
• With closure we can find all FD’s easily
Example
Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C)
1 Adp001 Muzamil Khanewal ADPcs
2 Adp002 Manzar Kabierwala ADPcs
3 Adp003 Muzamil Khanewal ADPcs
4 Adp004 Sheraz kahanewal ADPcs
Find (R)+
Solution
(R)+ R
RIC
RICN
RCINA(R)+
stop
R IC
IC N
RI N
N A
Closure set of attribute Exercise
Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C)
1 Adp001 Muzamil Khanewal ADPcs
2 Adp002 Manzar Kabierwala ADPcs
3 Adp003 Muzamil Khanewal ADPcs
4 Adp004 Sheraz kahanewal ADPcs
Find (IC)+
Solution
(IC)+ IC
ICN
ICNA(IC)+
R IC
IC N
RI N
N A
stop
Equivalence of functional dependency
After this slide we will able to compare two different set of functional
dependency.
Example
Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C)
1 Adp001 Muzamil Khanewal ADPcs
2 Adp002 Manzar Kabierwala ADPcs
3 Adp003 Muzamil Khanewal ADPcs
4 Adp004 Sheraz kahanewal ADPcs
I N
IN A
R IA
R C
I NA
R
R.S
(I)+ INA
(IN)+ INA
(R)+ INAC
(I)+ INA
(IN)+ INA
(R)+ INAC
L.S
IC L.S R.S
L.S R.S
L.S R.S
L.S R.S
What we have to find?
L.S R.S R.S L.S
stop
Irreducible set of FD (canonical Form)
• It means whether any given functional dependency there exist
some redundant element or not?
• If there exist some redundant element we must remove it from
functional dependency.
1. First we will apply decomposition role.
2. Second we will have single value for every determinate.
3. Third will compute closure of every determinate one by one and we will
have to ignoring and considering essential and non-essential
dependencies
4. Than we will remove redundant element.
We have these functional dependencies:
Decomposed Form
stop
R IC
IC NA
RI N
N A
R I
IC N
RI N
N A
R C
IC N
Canonical form
Closure of 1st FD
(R)+ RI
(R)+
Decomposed Form
Closure of 2nd FD
(R)+ RC
(R)+
Closure of 3rd FD
(IC)+ ICNA
(IC)+
Closure of 4th FD
(IC)+ ICA
(IC)+
Closure of 5th FD
(N)+ NA
(N)+
Canonical Form
R I
R C
N A
IC N
stop
R I
IC N
RI N
N A
R C
IC A
Closure of 5th FD
(RI)+ RIN
(RI)+
RI N
Key, Super, candidate, primary key
• We will discuses briefly again because it is very important.
Relation name stu
R IC
IC N
RI N
N A
Super key Candidate key Primary key
Yes Yes If selected by DBA
Yes No
Yes No
Yes Yes If selected by DBA
Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C)
1 Adp001 Muzamil Khanewal ADPcs
2 Adp002 Manzar Kabierwala ADPcs
3 Adp003 Muzamil Khanewal ADPcs
4 Adp004 Sheraz kahanewal ADPcs
stop Explain with diagram
Review
1. We briefly studied that what is normalization
2. Purposes and Characteristics of normalization
3. Then we understand the normalization diagram.
4. we understand that what is FD and its types with
examples (trivalent & non-trivalent FD).
5. We studied Closure set of attributes and how to
compute it with example.
6. We studied equivalence of FD and how to compute it.
7. What is irreducible set of FD or what is canonical form
.
8. We briefly studied about some keys.
9. How to find candidate key quickly.
Now we will study about normalization its types and
how we use functional dependency as a tool in
normalization.
Types of Normalization we will study
• There are three types of Normalization that
are essential for a effective database designe.
1st Normal Form (1NF)
2nd Normal Form (2NF)
3rd Normal Form (3NF)
There are some other types but these are not
important for us.
Before this we will discuss about partial and
transitive dependency.
UNF
StdID StdName SocietyID SocName SupID Supervisor Position
123 Masood 001
003
Urdu
Maths
1
2
Mr.Waseem
Ms.Chauhdry
Chairman
Member
132 zahra 001 Urdu 1 Mr.Waseem Member
142 javed 002
005
008
English
Physics
Biology
1
3
4
Mr.waseem
Mr.Liaqat
Miss Yasmeen
Member
Chairman
Member
This table is not a relational table.There is no primary key no any
foreign key in this relation.
The relation is consist of multi-valued attributes.
The above table is in UNF. We will apply first three normal forms to
the above relation.
1NF
• First normal form (1NF) is a property of a relation in a relational database.
A relation is in first normal form if and only if the domain of each attribute
contains only atomic (indivisible) values, and the value of each attribute
contains only a single value from that domain.
StdID StdName
123 Masood
132 Zahra
142 javed
Student relation
Student_in_Society relation
First we convert the whole table in to tow parts
Student and student_in_society relation, then we use
the primary key of first table in second table as
foreign key, and also make a primary key in the
second table.
StdID SocietyID SocName SupID Supervisor Position
123 001 Urdu 1 Mr.Waseem Chairman
123 003 Maths 2 Ms.Chauhdry Member
132 001 Urdu 1 Mr.Waseem Member
142 002 English 1 Mr.Waseem Member
142 005 Physics 3 Mr.Liaqat Chairman
142 008 Biology 4 Miss Yasmeen Member
stop
2NF
• StdID and SocietyID Belongs to Prime attribute because they are the part of
primary Key .
• Position, SocName, SupID are Belongs to Non-Prime attribute because they
are Not the Part of primary key.
• When a Non-prime attribute is dependent on a prime attribute this called
partial dependency.
StdID,SocietyID Position Full functioanlly dependecy
What is partial dependency?
StdID SocietyID SocName SupID Supervisor Position
123 001 Urdu 1 Mr.Waseem Chairman
123 003 Maths 2 Ms.Chauhdry Member
132 001 Urdu 1 Mr.Waseem Member
142 002 English 1 Mr.Waseem Member
142 005 Physics 3 Mr.Liaqat Chairman
142 008 Biology 4 Miss Yasmeen Member
SocietyID SocName
SocietyID SupID
Partial dependecy
Partial dependecy
stop
2NF
A relation will be in 2NF if it complete the requirements of
1NF and remove the partial dependencies from the relation.
StdID StdName
123 Masood
132 Zahra
142 javed
Student relation
Student_in_Society relation
For 2NF we will decompose the
student_in_society relation in two parts as:
student_in_society and Society relation.
SocietyID SocName SupID Supervisor
001 Urdu 1 Mr.Waseem
002 English 1 Mr.Waseem
003 Math 2 Ms.Chauhdry
005 Physics 3 Mr.Liaqat
008 Biology 4 Miss Yasmeen
StdID SocietyID Position
123 001 Chairman
123 003 Member
132 001 Member
142 002 Member
142 005 Chairman
142 008 Member
Society relation
stop
3NF
• SocietyID is a Prime attribute.
• SupID and Supervisor are Belongs to Non-Prime attribute because
they are Not the Part of primary key.
• When a Non-prime attribute is dependent on a Non-prime attribute
this called transitive dependency.
SocietyID SupID
What is transitive dependency?
SupID Supervisor
Full functional dependecy
Transitive dependecy
SocietyID SocName SupID Supervisor
001 Urdu 1 Mr.Waseem
002 English 1 Mr.Waseem
003 Math 2 Ms.Chauhdry
005 Physics 3 Mr.Liaqat
008 Biology 4 Miss Yasmeen
In society table the
stop
3NF
A relation will be in 3NF if it complete the requirements of 1NF, 2NF
and remove the transitive dependencies from the relation.
supID Supervisor
1 Mr.Waseem
2 Ms.Chauhdry
3 Mr.Liaqat
4 Miss Yasmeen
Society_in_Teacher relation
For 3NF we will decompose the society relation in two parts as:
society_in_ Teachter and Society relation.
SocietyID SocName SupID
001 Urdu 1
002 English 1
003 Math 2
005 Physics 3
008 Biology 4
Society relation
stop
UNF of relation
StdID StdName SocietyID SocName SupID Supervisor Position
123 Masood 001
003
Urdu
Maths
1
2
Mr.Waseem
Ms.Chauhdry
Chairman
Member
132 zahra 001 Urdu 1 Mr.Waseem Member
142 002
005
008
English
Physics
Biology
1
3
4
Mr.waseem
Mr.Liaqat
Miss Yasmeen
Member
Chairman
Member
UNF of relation
StdID StdName
Muzamil Khanewal
Manzar Kabierwala
Muzamil Khanewal
Student relation
supID Supervisor
1 Mr.Waseem
2 Ms.Chauhdry
3 Mr.Liaqat
4 Miss Yasmeen
Society_in_Teacher relation
SocietyID SocName SupID
001 Urdu 1
002 English 1
003 Math 2
005 Physics 3
008 Biology 4
Society relation
Student_in_Society relation
StdID SocietyID Position
123 001 Chairman
123 003 Member
132 001 Member
142 002 Member
142 005 Chairman
142 008 Member
stop
Thanks!

More Related Content

PDF
PPTX
REGULAR EXPRESSION TO N.F.A
PPT
Heap tree
PPTX
Entity Relationship Diagram – ER Diagram in DBMS.pptx
PPT
Joins in SQL
PPTX
Binary search tree
PPTX
Divide And Conquer.pptx
REGULAR EXPRESSION TO N.F.A
Heap tree
Entity Relationship Diagram – ER Diagram in DBMS.pptx
Joins in SQL
Binary search tree
Divide And Conquer.pptx

What's hot (20)

PPTX
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
PPTX
PPTX
Lec 04 - Logical Design (Relational Mapping).pptx
PPTX
SQL Joins.pptx
PPTX
SUBQUERIES.pptx
PPT
Trees - Data structures in C/Java
PPTX
normaliztion
PPTX
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
PPTX
advanced sql(database)
PPTX
Binary Search Tree
PPTX
Merge sort
PPT
Database Keys
PPT
Python Dictionaries and Sets
PPT
16717 functions in C++
 
PPTX
Key and its different types
PPTX
Attributes
PPTX
Classification of Data Structure -Linear and Non Linear
PPTX
Asymptotic notations
PPT
3 estructuras no lineales estáticas y dinámicas
Chapter 4 NumPy Basics Arrays and Vectorized Computation (Part I).pptx
Lec 04 - Logical Design (Relational Mapping).pptx
SQL Joins.pptx
SUBQUERIES.pptx
Trees - Data structures in C/Java
normaliztion
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
advanced sql(database)
Binary Search Tree
Merge sort
Database Keys
Python Dictionaries and Sets
16717 functions in C++
 
Key and its different types
Attributes
Classification of Data Structure -Linear and Non Linear
Asymptotic notations
3 estructuras no lineales estáticas y dinámicas
Ad

Similar to Normalization (20)

PDF
Database management system session 5
PPTX
Normalisation
PDF
Normalization.pdf
PPT
Normalisation revision
PPTX
Distributed DBMS - Unit 2 - Overview of RDBMS
PPTX
database Normalization
PPTX
Database Presentation
PDF
Chapter – 4 Normalization and Relational Algebra.pdf
PPT
Normmmalizzarion.ppt
PPT
Normal forms.ppt
PPTX
Unit 3 dbms
PDF
Chapter+3+-+Normalization.pdf
PPT
Normalization
PDF
Relational Database Design
PDF
Normalization
PPT
Normalization.ppt
PDF
Normalization in DBMS
PPT
NORMALIZATION in database management systems
PPTX
Year 11 DATA PROCESSING 1st Term
Database management system session 5
Normalisation
Normalization.pdf
Normalisation revision
Distributed DBMS - Unit 2 - Overview of RDBMS
database Normalization
Database Presentation
Chapter – 4 Normalization and Relational Algebra.pdf
Normmmalizzarion.ppt
Normal forms.ppt
Unit 3 dbms
Chapter+3+-+Normalization.pdf
Normalization
Relational Database Design
Normalization
Normalization.ppt
Normalization in DBMS
NORMALIZATION in database management systems
Year 11 DATA PROCESSING 1st Term
Ad

Recently uploaded (20)

PDF
PTS Company Brochure 2025 (1).pdf.......
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
top salesforce developer skills in 2025.pdf
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PPTX
Introduction to Artificial Intelligence
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Softaken Excel to vCard Converter Software.pdf
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
medical staffing services at VALiNTRY
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
Digital Strategies for Manufacturing Companies
PPTX
L1 - Introduction to python Backend.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PDF
Understanding Forklifts - TECH EHS Solution
PTS Company Brochure 2025 (1).pdf.......
How to Choose the Right IT Partner for Your Business in Malaysia
Wondershare Filmora 15 Crack With Activation Key [2025
Raksha Bandhan Grocery Pricing Trends in India 2025.pdf
CHAPTER 2 - PM Management and IT Context
top salesforce developer skills in 2025.pdf
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
VVF-Customer-Presentation2025-Ver1.9.pptx
How to Migrate SBCGlobal Email to Yahoo Easily
Introduction to Artificial Intelligence
Upgrade and Innovation Strategies for SAP ERP Customers
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Softaken Excel to vCard Converter Software.pdf
ISO 45001 Occupational Health and Safety Management System
medical staffing services at VALiNTRY
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
Digital Strategies for Manufacturing Companies
L1 - Introduction to python Backend.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Understanding Forklifts - TECH EHS Solution

Normalization

  • 2. what is Normalization? • The process of producing a simpler and more reliable database structure is called normalization. • We can only produce a simpler and more reliable database structure by eliminate redundancy from the database structure. • Redundancy means duplication of data in multiple files • Many problems can be occur in DB structure because of Redundancy.
  • 3. Purposes of Normalization 1. It makes the database design efficient in performance. 2. It reduces the amount of data if possible. 3. It makes the database design free of update, insertion and deletion anomalies/problems. 4. It makes the design according the rules of relational databases. 5. It identifies relationship b/w entities. 6. It makes a design that allows simple retrieval of data. 7. It simplifies data maintenance and reduces the need to restructure data. Characteristics of Normalized Database 1. Each relation must have a key field. 2. All fields must contain atomic data. 3. There must be no repeating fields. 4. Each table must contain information about a single entity. 5. Each field in a relation must depend on key fields. 6. All non-key fields must be mutually independent.
  • 4. Data Sources Users User’s Requirement Specification Sources like Data dictionary & Model Un-normalized Form (UNF) First Normal Form (1NF) Second Normal Form (2NF) Third Normal Form (3NF) Boyce-Codd Normal Form (BCNF) Fourth Normal Form (4NF) Normal Form (NF) Fifth Normal Form (5NF) Transfer attributes into Table Format Remove Partial Dependencies Remove Repeating Groups Remove Transitive Dependencies Make sure every determinate is candidate key Remove Multi-Valued Dependencies Remove Join Dependencies Normalization stop
  • 5. Functional Dependency • Functional dependency is a relationship between attributes. • It means that if the value of one attribute is known, it is possible to obtain the value of another attribute. • Sign of FD is “->”, The attribute on the left side of the sign known as Determinate. Suppose there is a table name student as bellow Std-Roll.No Reg.No Name Address 1 Adp001 Muzamil Khanewal 2 Adp002 Manzar Kabierwalw 3 Adp003 Muzamil Khanewal 4 Adp004 Sheraz khanewal If I say that Address Name valid/Not-v
  • 6. Exercise Std-Roll.No Reg.No Name Address 1 Adp001 Muzamil Khanewal 2 Adp002 Manzar Kabierwala 3 Adp003 Muzamil Khanewal 4 Adp004 Sheraz kahanewal If I say that Name Address valid/Not-v If I say that Std-Roll.No Name valid/Not-v If I say that Reg.No Address valid/Not-v 1 2 3
  • 7. Types of Functional Dependency 1. Trivalent: The dependency of an attribute on a set of attribute is known as trivalent functional dependency attribute if the set of attribute include that attribute. (we have no new information) In this table we assigned supposed names to the attributes. Std-Roll.No (I) Reg.No (R) Name (N) Address (A) 1 Adp001 Muzamil Khanewal 2 Adp002 Manzar Kabierwala 3 Adp003 Muzamil Khanewal 4 Adp004 Sheraz kahanewal If I say that IN N Trivalent FD In first case If I say that IN INA Non-Trivalent FD In second case R RINA Finding new stop
  • 8. Non-Trivalent FD Exercise Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C) 1 Adp001 Muzamil Khanewal ADPcs 2 Adp002 Manzar Kabierwala ADPcs 3 Adp003 Muzamil Khanewal ADPcs 4 Adp004 Sheraz kahanewal ADPcs Case 3 I RC valid/Not-v Case 1 IR NA valid/Not-v Case 4 IR NAC valid/Not-v Case 5 N AC valid/Not-v Case 6 NA I valid/Not-v Case 2 R IC valid/Not-v
  • 9. Closure set of attribute • Before go to normalization we should know the entire set of dependencies, and we can compute it only because of closure set of attribute. • With closure we can find all FD’s easily Example Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C) 1 Adp001 Muzamil Khanewal ADPcs 2 Adp002 Manzar Kabierwala ADPcs 3 Adp003 Muzamil Khanewal ADPcs 4 Adp004 Sheraz kahanewal ADPcs Find (R)+ Solution (R)+ R RIC RICN RCINA(R)+ stop R IC IC N RI N N A
  • 10. Closure set of attribute Exercise Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C) 1 Adp001 Muzamil Khanewal ADPcs 2 Adp002 Manzar Kabierwala ADPcs 3 Adp003 Muzamil Khanewal ADPcs 4 Adp004 Sheraz kahanewal ADPcs Find (IC)+ Solution (IC)+ IC ICN ICNA(IC)+ R IC IC N RI N N A stop
  • 11. Equivalence of functional dependency After this slide we will able to compare two different set of functional dependency. Example Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C) 1 Adp001 Muzamil Khanewal ADPcs 2 Adp002 Manzar Kabierwala ADPcs 3 Adp003 Muzamil Khanewal ADPcs 4 Adp004 Sheraz kahanewal ADPcs I N IN A R IA R C I NA R R.S (I)+ INA (IN)+ INA (R)+ INAC (I)+ INA (IN)+ INA (R)+ INAC L.S IC L.S R.S L.S R.S L.S R.S L.S R.S What we have to find? L.S R.S R.S L.S stop
  • 12. Irreducible set of FD (canonical Form) • It means whether any given functional dependency there exist some redundant element or not? • If there exist some redundant element we must remove it from functional dependency. 1. First we will apply decomposition role. 2. Second we will have single value for every determinate. 3. Third will compute closure of every determinate one by one and we will have to ignoring and considering essential and non-essential dependencies 4. Than we will remove redundant element. We have these functional dependencies: Decomposed Form stop R IC IC NA RI N N A R I IC N RI N N A R C IC N
  • 13. Canonical form Closure of 1st FD (R)+ RI (R)+ Decomposed Form Closure of 2nd FD (R)+ RC (R)+ Closure of 3rd FD (IC)+ ICNA (IC)+ Closure of 4th FD (IC)+ ICA (IC)+ Closure of 5th FD (N)+ NA (N)+ Canonical Form R I R C N A IC N stop R I IC N RI N N A R C IC A Closure of 5th FD (RI)+ RIN (RI)+ RI N
  • 14. Key, Super, candidate, primary key • We will discuses briefly again because it is very important. Relation name stu R IC IC N RI N N A Super key Candidate key Primary key Yes Yes If selected by DBA Yes No Yes No Yes Yes If selected by DBA Std-Roll.No (I) Reg.No (R) Name (N) Address (A) Class (C) 1 Adp001 Muzamil Khanewal ADPcs 2 Adp002 Manzar Kabierwala ADPcs 3 Adp003 Muzamil Khanewal ADPcs 4 Adp004 Sheraz kahanewal ADPcs stop Explain with diagram
  • 15. Review 1. We briefly studied that what is normalization 2. Purposes and Characteristics of normalization 3. Then we understand the normalization diagram. 4. we understand that what is FD and its types with examples (trivalent & non-trivalent FD). 5. We studied Closure set of attributes and how to compute it with example. 6. We studied equivalence of FD and how to compute it. 7. What is irreducible set of FD or what is canonical form . 8. We briefly studied about some keys. 9. How to find candidate key quickly. Now we will study about normalization its types and how we use functional dependency as a tool in normalization.
  • 16. Types of Normalization we will study • There are three types of Normalization that are essential for a effective database designe. 1st Normal Form (1NF) 2nd Normal Form (2NF) 3rd Normal Form (3NF) There are some other types but these are not important for us. Before this we will discuss about partial and transitive dependency.
  • 17. UNF StdID StdName SocietyID SocName SupID Supervisor Position 123 Masood 001 003 Urdu Maths 1 2 Mr.Waseem Ms.Chauhdry Chairman Member 132 zahra 001 Urdu 1 Mr.Waseem Member 142 javed 002 005 008 English Physics Biology 1 3 4 Mr.waseem Mr.Liaqat Miss Yasmeen Member Chairman Member This table is not a relational table.There is no primary key no any foreign key in this relation. The relation is consist of multi-valued attributes. The above table is in UNF. We will apply first three normal forms to the above relation.
  • 18. 1NF • First normal form (1NF) is a property of a relation in a relational database. A relation is in first normal form if and only if the domain of each attribute contains only atomic (indivisible) values, and the value of each attribute contains only a single value from that domain. StdID StdName 123 Masood 132 Zahra 142 javed Student relation Student_in_Society relation First we convert the whole table in to tow parts Student and student_in_society relation, then we use the primary key of first table in second table as foreign key, and also make a primary key in the second table. StdID SocietyID SocName SupID Supervisor Position 123 001 Urdu 1 Mr.Waseem Chairman 123 003 Maths 2 Ms.Chauhdry Member 132 001 Urdu 1 Mr.Waseem Member 142 002 English 1 Mr.Waseem Member 142 005 Physics 3 Mr.Liaqat Chairman 142 008 Biology 4 Miss Yasmeen Member stop
  • 19. 2NF • StdID and SocietyID Belongs to Prime attribute because they are the part of primary Key . • Position, SocName, SupID are Belongs to Non-Prime attribute because they are Not the Part of primary key. • When a Non-prime attribute is dependent on a prime attribute this called partial dependency. StdID,SocietyID Position Full functioanlly dependecy What is partial dependency? StdID SocietyID SocName SupID Supervisor Position 123 001 Urdu 1 Mr.Waseem Chairman 123 003 Maths 2 Ms.Chauhdry Member 132 001 Urdu 1 Mr.Waseem Member 142 002 English 1 Mr.Waseem Member 142 005 Physics 3 Mr.Liaqat Chairman 142 008 Biology 4 Miss Yasmeen Member SocietyID SocName SocietyID SupID Partial dependecy Partial dependecy stop
  • 20. 2NF A relation will be in 2NF if it complete the requirements of 1NF and remove the partial dependencies from the relation. StdID StdName 123 Masood 132 Zahra 142 javed Student relation Student_in_Society relation For 2NF we will decompose the student_in_society relation in two parts as: student_in_society and Society relation. SocietyID SocName SupID Supervisor 001 Urdu 1 Mr.Waseem 002 English 1 Mr.Waseem 003 Math 2 Ms.Chauhdry 005 Physics 3 Mr.Liaqat 008 Biology 4 Miss Yasmeen StdID SocietyID Position 123 001 Chairman 123 003 Member 132 001 Member 142 002 Member 142 005 Chairman 142 008 Member Society relation stop
  • 21. 3NF • SocietyID is a Prime attribute. • SupID and Supervisor are Belongs to Non-Prime attribute because they are Not the Part of primary key. • When a Non-prime attribute is dependent on a Non-prime attribute this called transitive dependency. SocietyID SupID What is transitive dependency? SupID Supervisor Full functional dependecy Transitive dependecy SocietyID SocName SupID Supervisor 001 Urdu 1 Mr.Waseem 002 English 1 Mr.Waseem 003 Math 2 Ms.Chauhdry 005 Physics 3 Mr.Liaqat 008 Biology 4 Miss Yasmeen In society table the stop
  • 22. 3NF A relation will be in 3NF if it complete the requirements of 1NF, 2NF and remove the transitive dependencies from the relation. supID Supervisor 1 Mr.Waseem 2 Ms.Chauhdry 3 Mr.Liaqat 4 Miss Yasmeen Society_in_Teacher relation For 3NF we will decompose the society relation in two parts as: society_in_ Teachter and Society relation. SocietyID SocName SupID 001 Urdu 1 002 English 1 003 Math 2 005 Physics 3 008 Biology 4 Society relation stop
  • 23. UNF of relation StdID StdName SocietyID SocName SupID Supervisor Position 123 Masood 001 003 Urdu Maths 1 2 Mr.Waseem Ms.Chauhdry Chairman Member 132 zahra 001 Urdu 1 Mr.Waseem Member 142 002 005 008 English Physics Biology 1 3 4 Mr.waseem Mr.Liaqat Miss Yasmeen Member Chairman Member
  • 24. UNF of relation StdID StdName Muzamil Khanewal Manzar Kabierwala Muzamil Khanewal Student relation supID Supervisor 1 Mr.Waseem 2 Ms.Chauhdry 3 Mr.Liaqat 4 Miss Yasmeen Society_in_Teacher relation SocietyID SocName SupID 001 Urdu 1 002 English 1 003 Math 2 005 Physics 3 008 Biology 4 Society relation Student_in_Society relation StdID SocietyID Position 123 001 Chairman 123 003 Member 132 001 Member 142 002 Member 142 005 Chairman 142 008 Member stop