SlideShare a Scribd company logo
1 of 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

More Related Content

What's hot

Functional Dependency
Functional DependencyFunctional Dependency
Functional DependencyAlaanoor94
 
Nested queries in database
Nested queries in databaseNested queries in database
Nested queries in databaseSatya P. Joshi
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationVisakh V
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalizationUniversity of Potsdam
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFBiplap Bhattarai
 
Dbms 3: 3 Schema Architecture
Dbms 3: 3 Schema ArchitectureDbms 3: 3 Schema Architecture
Dbms 3: 3 Schema ArchitectureAmiya9439793168
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbmsNaresh Kumar
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraintsmadhav bansal
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional DependencyRaj Naik
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMSkoolkampus
 
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
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMSPadamNepal1
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMSkoolkampus
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMSMegha Patel
 

What's hot (20)

Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Lossless decomposition
Lossless decompositionLossless decomposition
Lossless decomposition
 
Functional Dependency
Functional DependencyFunctional Dependency
Functional Dependency
 
Relational model
Relational modelRelational model
Relational model
 
Bcnf
BcnfBcnf
Bcnf
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
Normalization
NormalizationNormalization
Normalization
 
Nested queries in database
Nested queries in databaseNested queries in database
Nested queries in database
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NFNormalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
Normalization | (1NF) |(2NF) (3NF)|BCNF| 4NF |5NF
 
Dbms 3: 3 Schema Architecture
Dbms 3: 3 Schema ArchitectureDbms 3: 3 Schema Architecture
Dbms 3: 3 Schema Architecture
 
All data models in dbms
All data models in dbmsAll data models in dbms
All data models in dbms
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Decomposition using Functional Dependency
Decomposition using Functional DependencyDecomposition using Functional Dependency
Decomposition using Functional Dependency
 
2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS2. Entity Relationship Model in DBMS
2. Entity Relationship Model in DBMS
 
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
 
Types Of Keys in DBMS
Types Of Keys in DBMSTypes Of Keys in DBMS
Types Of Keys in DBMS
 
6. Integrity and Security in DBMS
6. Integrity and Security in DBMS6. Integrity and Security in DBMS
6. Integrity and Security in DBMS
 
Transaction management DBMS
Transaction  management DBMSTransaction  management DBMS
Transaction management DBMS
 

Similar to Functional dependencies in Database Management System

24042020_normalization 1.pdf
24042020_normalization 1.pdf24042020_normalization 1.pdf
24042020_normalization 1.pdfShivani139202
 
DBMS FDs and Normalization.pptx
DBMS FDs and Normalization.pptxDBMS FDs and Normalization.pptx
DBMS FDs and Normalization.pptxSakshamLal3
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.pptKalpanaThakre2
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMSkoolkampus
 
Database normalization
Database normalizationDatabase normalization
Database normalizationVARSHAKUMARI49
 
DBMS Unit 3.pptx
DBMS Unit 3.pptxDBMS Unit 3.pptx
DBMS Unit 3.pptxAmitDrKhare
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management SystemDrishti Bhalla
 
Database Management System [DBMS]
Database Management System [DBMS]Database Management System [DBMS]
Database Management System [DBMS]Shalabh Chaudhary
 
Introduction to database-Normalisation
Introduction to database-NormalisationIntroduction to database-Normalisation
Introduction to database-NormalisationAjit Nayak
 
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 3NFijdms
 

Similar to 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
 
Fd & Normalization - Database Management System
Fd & Normalization - Database Management SystemFd & Normalization - Database Management System
Fd & Normalization - Database Management System
 
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]
 
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
 

Recently uploaded

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfadityarao40181
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 

Recently uploaded (20)

Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Biting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdfBiting mechanism of poisonous snakes.pdf
Biting mechanism of poisonous snakes.pdf
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
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
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 

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