SlideShare una empresa de Scribd logo
1 de 26
Topic : FUNCTIONAL
DEPENDENCIES
Prepared By:
Kevin Jadiya
Subject : Database Management System
Functional dependency:
• A dependency occurs in a database when information stored in
the same database table uniquely determines other information
stored in the same table.
or
• You can also describe this as a relationship where knowing the
value of one attribute is enough to tell you the value of another
attribute in the same table.
Definition:
Functional dependency is a relationship that exists
when one attribute uniquely determines another attribute.
• It is represented by an arrow () sign.
•Example:
Acc_no Cus_name Balance address
A1 Rahul 60000 veraval
A2 Meet 78000 Mehsana
A3 Prashant 65000 surat
•if we know the value of account no, we can obtain cus_name,address,
balance etc.
•By this, we can say that address,cus_name and balance is functionally
dependent on account no.
Set of rules to define functional dependency
1. Reflexivity rule:
if Y ⊆ X , then X Y
x  y
Determinant Dependent
Read as…..
x holds y (from left to right)
or
y is dependent on x (from right to left)
Basic terminolog
2. Augmentation rule :
if x  y, then xz  yz for any z.
where , z is a set of attributes.
3. Transitivity rule :
if x  y and y  z ,then x  z.
4. Union rule :
if x  y and x  z, then x  yz.
5. Decomposition rule :
if x  yz,then x  y and x  z.
6. Pseudotransitivity rule :
if x  y and wy  z,then xw  z.
7. Composition rule :
if x  y and w  z then x,w  y,z.
8. Self-determination rule :
x  x
Types of functional dependencies:
1. Full functional dependency :
In a relation, the attribute B is
fully functionally dependent on A, if B is functionally dependent
on A but not on any proper subset of A.
• If we remove one of the attribute from the given relation then
dependency does not exist in fully functional dependency.
•Example :
{roll_no, dept_name}  SPI
2.Partial functional dependency :
In a relationship , the attribute B is
partially functionally dependent on A,if B is functionally
dependent on A as well as on any proper subset of A.
• if there is some attributes that can be remove from A and
then still the dependency holds it is known as partial
dependency.
•Example:
{enrollment_no,dept_name} 
SPI
3. Transitive functional dependency:
in a relation, if attribute
A  B and B  C then C is transitively dependent on A via B.
(provided that A is not functionally dependent on B and C)
•Example:
1. if , {staff_id}  {staff_name} &
{staff_name}  {staff_address}
then , {staff_id}  {staff_address}
2. if , {Book}  {Author}
{Author}  {Author_nationality}
then, {book}  {Author_nationality}
4. Trivial functional dependency:
In a relationship, if attribute
Y is a subset of attribute X then the dependency is known as
trivial functional dependency.
•Example:
x  y where y ⊆ x
{roll_no, dept_name} roll_no
5. Non-trivial functional dependency:
in a relationship, if attribute Y
is not a subset of attribute X then it is known as non-trivial
dependency.
• Example:
x  y where y ⊈ x
{roll_no, dept_name}  student_name
Redundant functional dependency:
A functional dependency
In the set is said to be redundant if it can be derived from the
other functional dependency in the set.
Algorithm to find redundant functional dependency:
Input:
let F be a set of FDs for relation R.
let f: AB is a FD to be examined for redundancy.
Step 1 : F’= F - f # find out new set of FDs by
removing f from F.
Step 2 : T = A # set T equals to determinant of
A  B
Step 3 : for each FD X  Y in F’ do
if….. X ⊆ T then, # If X is contained in T
T=T ⋃ Y # Add Y to T.
end if
Step 4 : if…… B ⊆ T then, # If B is contained in T
f:AB is redundant # Given functional dependency.
end if.
Output :
decision whether given functional dependency is redundan
or not.
Example : suppose a relation R is given with attributes A,B,C,D
& E also set of FDs is given as follow:
F={A  B, C  D, BD  E, AC  E}
(I) Find out whether functional dependency f:AC  E is redundant
or not?
(II) Find out whether functional dependency f:BD E is redundant
or not?
Solution (I): (for f:AC E).....
step 1: F’={AB,CD,BDE} # F’=F-f
step 2: T=AC # Set T= determinant of
AC E.
Step 3: T=AC+B = ACB # AB is in F’ and A ⊆ T.
T=ACB+D = ACBD # C D is in F’ and C ⊆ T.
T=ACBD+E = ACBDE # BD E is in F’ and BD ⊆ T.
Step 4: E ⊆ T.
Hence, f: ACE is redundant.
Solution (II): (for f:BD E)……
Step 1 : F’={AB ,CD ,ACE} # F’=F-f
Step 2 : T=BD # Set T=determinant
of BDE.
Step 3 : Nothing can be added to set T.
Hence, f: BDE is not redundant .
Closure set of functional dependency :
A closure set of a functional dependency is a set
of
all possible functional dependency that can be derived from a
given set of functional dependencies.
• it is also known as complete set of functional dependencies.
•If F is used to denote the set of FDs for relation R then closure
set of FDs implied by F, it is denoted by F+ .
Algorithm to find closure set of FD:
• Given a set of attributes A, define the closure of A for F as
the set of attributes that are functionally determined by A
under F (find A+ ) .
result = A
while (changes to result) do..
for each XY in F do…
begin
if ….X ⊆ result….then,
result=result ⋃ Y
end
Example to calculate the closure set of FD:
Example 1.Given the following result R={A,B,C}.A set of FD is as
follow:
AB
BC
find out closure of A,B and C? (find A+ ,B+ and C+ )
Solution : (i) A+ = A # A+ = A
= AB # A ⊆ A+ so B ⋃ A+
= ABC # B ⊆ A+ so C ⋃ A+
(ii) B+ = B # B+ =B
= BC #B ⊆ B+ so C ⋃ B+
(iii) C+ = C #C+ =C
Example 2 : Given the following result R={A,B,C,D}.A set of FD is
as follow:
AB, BC,ABD
find closure for A and AB.
Solution : A+ = A #A+ = A
= AB #A ⊆ A+ so B ⋃ A+
= ABC #B ⊆ A+ so C ⋃ A+
= ABCD #AB ⊆ A+ so D ⋃ A+
(AB)+ =AB # (AB)+ = AB
=ABD # AB ⊆ (AB)+ so D ⋃ (AB)+
=ABCD # B ⊆ (AB)+ so C ⋃ (AB)+
Decomposition :
The process of breaking down the given relatio
into two or more relations is known as decomposition.
• Here relation R is replaced by another relation in such a way that…
1. Each new relation contains a subset of the attributes of R
and
2. Together, they all include all tuples and attributes of R.
• example:
R: Account(a_no,balance,B_name,B_city)
R1: Account(a_no,balance,b_name)
R2: Branch(b_name,b_city)
•There are two types of decomposition:
1. lossy decomposition
2. lossless decomposition
1.lossy decomposition:
The decomposition of R into R1 and R2
is lossy when the joint of R1 and R2 does not give the same
relation as in R.
2.Lossless decomposition:
The decomposition of R into R1 and R2
is lossless when the joint of R1 and R2 produces the same
relation as in R.
Example of lossy decomposition:
Balance B_name
5000 Vvn
2000 kkn
8000 kkn
Main table:
decomposition
T1
T2
A_no Balance B_name
A01 5000 Vvn
A02 2000 Kkn
A02 8000 kkn
A03 2000 Kkn
A03 8000 kkn
Joined table:
The resultant joined table
from T1 and T2
which is not same as the
main table.
A_no balance B_name
A01 5000 Vvn
A02 2000 kkn
A03 8000 Kkn
A_no Balance
A01 Vvn
A02 Kkn
A03 kkn
A_no balance B_name
A01 5000 Vvn
A02 2000 kkn
A03 8000 Kkn
A_no B_name
A01 Vvn
A02 kkn
A03 kkn
A_no Balance
A01 5000
A02 2000
A03 8000
A_no balance B_name
A01 5000 Vvn
A02 2000 kkn
A03 8000 kkn
Example of lossless decomposition:
Main table:
T1
T2
Joined table:
The resultant joined table
from T1 and T2
which is same as the
main table.
decomposition
THANK YOU

Más contenido relacionado

La actualidad más candente

Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationVisakh V
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational modelChirag vasava
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in DatabaseRoshni Singh
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional DependencyRaj Naik
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFOum Saokosal
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database conceptsTemesgenthanks
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMSPadamNepal1
 
Database Normalization
Database NormalizationDatabase Normalization
Database NormalizationArun Sharma
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbmsshekhar1991
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - NormalizationMudasir Qazi
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure shameen khan
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Jargalsaikhan Alyeksandr
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management SystemDrishti Bhalla
 

La actualidad más candente (20)

Dbms normalization
Dbms normalizationDbms normalization
Dbms normalization
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Normalization in Database
Normalization in DatabaseNormalization in Database
Normalization in Database
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Database - Normalization
Database - NormalizationDatabase - Normalization
Database - Normalization
 
linked list in data structure
linked list in data structure linked list in data structure
linked list in data structure
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 

Similar a Functional dependencies in Database Management System

Similar a Functional dependencies in Database Management System (20)

24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdf
 
DBMS FDs and Normalization.pptx
DBMS FDs and Normalization.pptxDBMS FDs and Normalization.pptx
DBMS FDs and Normalization.pptx
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
Cs501 fd nf
Cs501 fd nfCs501 fd nf
Cs501 fd nf
 
Normalization
NormalizationNormalization
Normalization
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
Assignment#16
Assignment#16Assignment#16
Assignment#16
 
UNIT 2 -PPT.pptx
UNIT 2 -PPT.pptxUNIT 2 -PPT.pptx
UNIT 2 -PPT.pptx
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptx
 
18560 lecture6
18560 lecture618560 lecture6
18560 lecture6
 
Normalization
NormalizationNormalization
Normalization
 
L8 design1
L8 design1L8 design1
L8 design1
 
test
testtest
test
 
DBMS Helping material
DBMS Helping materialDBMS Helping material
DBMS Helping material
 
Database Management System [DBMS]
Database Management System [DBMS]Database Management System [DBMS]
Database Management System [DBMS]
 
Normalization
NormalizationNormalization
Normalization
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-Normalisation
 
DBMS 3.pdf
DBMS 3.pdfDBMS 3.pdf
DBMS 3.pdf
 
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NFALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
ALGORITHM FOR RELATIONAL DATABASE NORMALIZATION UP TO 3NF
 

Último

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingTeacherCyreneCayanan
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 

Último (20)

IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
fourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writingfourth grading exam for kindergarten in writing
fourth grading exam for kindergarten in writing
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 

Functional dependencies in Database Management System

  • 1. Topic : FUNCTIONAL DEPENDENCIES Prepared By: Kevin Jadiya Subject : Database Management System
  • 2. Functional dependency: • A dependency occurs in a database when information stored in the same database table uniquely determines other information stored in the same table. or • You can also describe this as a relationship where knowing the value of one attribute is enough to tell you the value of another attribute in the same table.
  • 3. Definition: Functional dependency is a relationship that exists when one attribute uniquely determines another attribute. • It is represented by an arrow () sign. •Example: Acc_no Cus_name Balance address A1 Rahul 60000 veraval A2 Meet 78000 Mehsana A3 Prashant 65000 surat •if we know the value of account no, we can obtain cus_name,address, balance etc. •By this, we can say that address,cus_name and balance is functionally dependent on account no.
  • 4. Set of rules to define functional dependency 1. Reflexivity rule: if Y ⊆ X , then X Y x  y Determinant Dependent Read as….. x holds y (from left to right) or y is dependent on x (from right to left) Basic terminolog
  • 5. 2. Augmentation rule : if x  y, then xz  yz for any z. where , z is a set of attributes. 3. Transitivity rule : if x  y and y  z ,then x  z. 4. Union rule : if x  y and x  z, then x  yz. 5. Decomposition rule : if x  yz,then x  y and x  z.
  • 6. 6. Pseudotransitivity rule : if x  y and wy  z,then xw  z. 7. Composition rule : if x  y and w  z then x,w  y,z. 8. Self-determination rule : x  x
  • 7. Types of functional dependencies: 1. Full functional dependency : In a relation, the attribute B is fully functionally dependent on A, if B is functionally dependent on A but not on any proper subset of A. • If we remove one of the attribute from the given relation then dependency does not exist in fully functional dependency. •Example : {roll_no, dept_name}  SPI
  • 8. 2.Partial functional dependency : In a relationship , the attribute B is partially functionally dependent on A,if B is functionally dependent on A as well as on any proper subset of A. • if there is some attributes that can be remove from A and then still the dependency holds it is known as partial dependency. •Example: {enrollment_no,dept_name}  SPI
  • 9. 3. Transitive functional dependency: in a relation, if attribute A  B and B  C then C is transitively dependent on A via B. (provided that A is not functionally dependent on B and C) •Example: 1. if , {staff_id}  {staff_name} & {staff_name}  {staff_address} then , {staff_id}  {staff_address} 2. if , {Book}  {Author} {Author}  {Author_nationality} then, {book}  {Author_nationality}
  • 10. 4. Trivial functional dependency: In a relationship, if attribute Y is a subset of attribute X then the dependency is known as trivial functional dependency. •Example: x  y where y ⊆ x {roll_no, dept_name} roll_no
  • 11. 5. Non-trivial functional dependency: in a relationship, if attribute Y is not a subset of attribute X then it is known as non-trivial dependency. • Example: x  y where y ⊈ x {roll_no, dept_name}  student_name
  • 12. Redundant functional dependency: A functional dependency In the set is said to be redundant if it can be derived from the other functional dependency in the set.
  • 13. Algorithm to find redundant functional dependency: Input: let F be a set of FDs for relation R. let f: AB is a FD to be examined for redundancy. Step 1 : F’= F - f # find out new set of FDs by removing f from F. Step 2 : T = A # set T equals to determinant of A  B
  • 14. Step 3 : for each FD X  Y in F’ do if….. X ⊆ T then, # If X is contained in T T=T ⋃ Y # Add Y to T. end if Step 4 : if…… B ⊆ T then, # If B is contained in T f:AB is redundant # Given functional dependency. end if. Output : decision whether given functional dependency is redundan or not.
  • 15. Example : suppose a relation R is given with attributes A,B,C,D & E also set of FDs is given as follow: F={A  B, C  D, BD  E, AC  E} (I) Find out whether functional dependency f:AC  E is redundant or not? (II) Find out whether functional dependency f:BD E is redundant or not? Solution (I): (for f:AC E)..... step 1: F’={AB,CD,BDE} # F’=F-f step 2: T=AC # Set T= determinant of AC E.
  • 16. Step 3: T=AC+B = ACB # AB is in F’ and A ⊆ T. T=ACB+D = ACBD # C D is in F’ and C ⊆ T. T=ACBD+E = ACBDE # BD E is in F’ and BD ⊆ T. Step 4: E ⊆ T. Hence, f: ACE is redundant.
  • 17. Solution (II): (for f:BD E)…… Step 1 : F’={AB ,CD ,ACE} # F’=F-f Step 2 : T=BD # Set T=determinant of BDE. Step 3 : Nothing can be added to set T. Hence, f: BDE is not redundant .
  • 18. Closure set of functional dependency : A closure set of a functional dependency is a set of all possible functional dependency that can be derived from a given set of functional dependencies. • it is also known as complete set of functional dependencies. •If F is used to denote the set of FDs for relation R then closure set of FDs implied by F, it is denoted by F+ .
  • 19. Algorithm to find closure set of FD: • Given a set of attributes A, define the closure of A for F as the set of attributes that are functionally determined by A under F (find A+ ) . result = A while (changes to result) do.. for each XY in F do… begin if ….X ⊆ result….then, result=result ⋃ Y end
  • 20. Example to calculate the closure set of FD: Example 1.Given the following result R={A,B,C}.A set of FD is as follow: AB BC find out closure of A,B and C? (find A+ ,B+ and C+ ) Solution : (i) A+ = A # A+ = A = AB # A ⊆ A+ so B ⋃ A+ = ABC # B ⊆ A+ so C ⋃ A+ (ii) B+ = B # B+ =B = BC #B ⊆ B+ so C ⋃ B+ (iii) C+ = C #C+ =C
  • 21. Example 2 : Given the following result R={A,B,C,D}.A set of FD is as follow: AB, BC,ABD find closure for A and AB. Solution : A+ = A #A+ = A = AB #A ⊆ A+ so B ⋃ A+ = ABC #B ⊆ A+ so C ⋃ A+ = ABCD #AB ⊆ A+ so D ⋃ A+ (AB)+ =AB # (AB)+ = AB =ABD # AB ⊆ (AB)+ so D ⋃ (AB)+ =ABCD # B ⊆ (AB)+ so C ⋃ (AB)+
  • 22. Decomposition : The process of breaking down the given relatio into two or more relations is known as decomposition. • Here relation R is replaced by another relation in such a way that… 1. Each new relation contains a subset of the attributes of R and 2. Together, they all include all tuples and attributes of R. • example: R: Account(a_no,balance,B_name,B_city) R1: Account(a_no,balance,b_name) R2: Branch(b_name,b_city)
  • 23. •There are two types of decomposition: 1. lossy decomposition 2. lossless decomposition 1.lossy decomposition: The decomposition of R into R1 and R2 is lossy when the joint of R1 and R2 does not give the same relation as in R. 2.Lossless decomposition: The decomposition of R into R1 and R2 is lossless when the joint of R1 and R2 produces the same relation as in R.
  • 24. Example of lossy decomposition: Balance B_name 5000 Vvn 2000 kkn 8000 kkn Main table: decomposition T1 T2 A_no Balance B_name A01 5000 Vvn A02 2000 Kkn A02 8000 kkn A03 2000 Kkn A03 8000 kkn Joined table: The resultant joined table from T1 and T2 which is not same as the main table. A_no balance B_name A01 5000 Vvn A02 2000 kkn A03 8000 Kkn A_no Balance A01 Vvn A02 Kkn A03 kkn
  • 25. A_no balance B_name A01 5000 Vvn A02 2000 kkn A03 8000 Kkn A_no B_name A01 Vvn A02 kkn A03 kkn A_no Balance A01 5000 A02 2000 A03 8000 A_no balance B_name A01 5000 Vvn A02 2000 kkn A03 8000 kkn Example of lossless decomposition: Main table: T1 T2 Joined table: The resultant joined table from T1 and T2 which is same as the main table. decomposition