SlideShare a Scribd company logo
1 of 18
Functional
Dependencies
R L D D Rajapaksha
Diploma in Software Application Development
Wayamba University of Sri Lanka, Kuliyapitiya
13 May 2018
2
Functional Dependencies…?
• Functional Dependency (FD) is a constraint that describes
the relationship between attributes in the relation (table).
• FDs and Keys are used to define the normal forms for
relations.
3
Functional Dependencies…? (cont…)
Definition :
Relation schema: R {A1,A2,...,An}
X , Y are subsets of R
If R: X Y then,
If t1[X]=t2[X] then,
t1[Y]=t2[Y] in any relation instance r(R)
R
t2
t1
YX
4
Examples for FD constraints.
5
Examples for FD constraints.
• Student ID determines Student name and Birth date.
StID  {StName, Bdate}
• Sport Name determines type of sport.
SpName  type
• Student ID and Sport Name determine the hours per week that
the student practices his sport.
{StID, SpName}  hours
6
Functional Dependencies…? (cont…)
• A FD is a property of attributes in the relational schema R
(intension).
• If L is a key of the relation R, it determines all the attributes of
R.
7
Inference Rules for FDs.
• Armstrong's inference rules
A1. (Reflexive) If Y subset-of X, then X  Y
A2. (Augmentation) If X  Y, then XZ  YZ
(Notation: XZ stands for X U Z)
A3. (Transitive) If X  Y and Y  Z, then X  Z
Go back Slide 14
8
Additional Useful Inference Rules.
• Decomposition
If X  YZ, then X  Y and X  Z
• Union
If X  Y and X  Z, then X  YZ
• Psuedotransitivity
If X  Y and WY  Z, then WX  Z
9
Types of Functional Dependencies.
1. Trivial Functional Dependency.
2. Non-Trivial Functional Dependency.
3. Multi-valued Dependency.
4. Transitivity Dependency.
10
1. Trivial Functional Dependency.
• The dependency of an attribute on a set of attributes is known
as trivial functional dependency if the set of attributes includes
that attribute.
If B is a subset of A then,
ABB
AA
BB
A B
11
2. Non-Trivial Functional Dependency.
• If a functional dependency X->Y holds true where Y is not a
subset of X
If B is not a subset of A then,
AB
A B
12
3. Multi-valued Dependency.
• If there are more than one independent multi-valued attributes
in a relation, that is called “multi-valued dependency”.
bike_model manf_year colour
V001 2011 Black
V001 2011 Blue
V002 2012 Black
V002 2012 Blue
V003 2013 Black
V003 2013 Blue
bike_model ->> manf_year
bike_model ->> colour
13
4. Transitivity Dependency.
• A functional dependency is said to be transitive if it is indirectly
formed by two functional dependencies.
Transitive dependency: XZ;
if the following three functional dependencies hold TRUE,
XY
Y does not X
YZ
• Can only occur in a relation of three or more attributes.
• Helps to normalizing the DB in 3NF.
14
Example_Transitivity Dependency.
Book Author Author_Age
ABC Nimal Bandara 48
XY Sakunthala Weerasinghe 36
MNO Nimal Bandara 48
{Book}  {Author}
{Author} does not  {Book}
{Book} { Author_Age}
Therefore Transitive Dependency is;
{Book}  {Author_Age} ; inference rules
15
Closure of Functional Dependency.
Closure of a set (X+) is the set of attributes functionally determined by
X.
Let S be the set of functional dependencies on relation R. Let X is set
of attributes that appear on left hand side of some FD in S and we
want to determine the set of all attributes that are dependent on X.
Thus for each such set of attribute X, we determine the set X+ of
attributes that are functionally determined by X based on S, X+ is
called closure of X under S
-www.edugrabs.com-
16
Example_Closure of Functional Dependency.
Closure of A (A+)
A+ = A
A(BC) ; from (1)
AB(CD)C ; from (2)
ABCDC = ABCD
So, A+ = ABCD
A B C D
Functional Dependencies:
(1); A  BC
(2); B  CD
17
Applications_Closure of Functional Dependency.
• It is used to identify the additional FDs.
• It is used to identify keys(CKs and SKs).
• It is used to identify the Prime and Non-Prime Attributes.
• It is used to identify equivalence of FD.
THANK YOU
18

More Related Content

What's hot

What's hot (20)

Database language
Database languageDatabase language
Database language
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Er diagram
Er diagramEr diagram
Er diagram
 
Relational Algebra & Calculus
Relational Algebra & CalculusRelational Algebra & Calculus
Relational Algebra & Calculus
 
Decomposition methods in DBMS
Decomposition methods in DBMSDecomposition methods in DBMS
Decomposition methods in DBMS
 
Relational model
Relational modelRelational model
Relational model
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
Relational Database Design
Relational Database DesignRelational Database Design
Relational Database Design
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Graph in data structure
Graph in data structureGraph in data structure
Graph in data structure
 
Relational algebra ppt
Relational algebra pptRelational algebra ppt
Relational algebra ppt
 
Functional dependency
Functional dependencyFunctional dependency
Functional dependency
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)Presentation on Relational Schema (Database)
Presentation on Relational Schema (Database)
 
Database architecture
Database architectureDatabase architecture
Database architecture
 
DBMS Unit - 6 - Transaction Management
DBMS Unit - 6 - Transaction ManagementDBMS Unit - 6 - Transaction Management
DBMS Unit - 6 - Transaction Management
 
basic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptxbasic structure of SQL FINAL.pptx
basic structure of SQL FINAL.pptx
 
Chapter-7 Relational Calculus
Chapter-7 Relational CalculusChapter-7 Relational Calculus
Chapter-7 Relational Calculus
 
Relational algebra in dbms
Relational algebra in dbmsRelational algebra in dbms
Relational algebra in dbms
 
ARCHITECTURE OF DBMS (1).ppt
ARCHITECTURE OF DBMS (1).pptARCHITECTURE OF DBMS (1).ppt
ARCHITECTURE OF DBMS (1).ppt
 

Similar to Functional dependency

7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
koolkampus
 

Similar to Functional dependency (20)

Normalization
NormalizationNormalization
Normalization
 
Normalization
NormalizationNormalization
Normalization
 
Normalization1
Normalization1Normalization1
Normalization1
 
test
testtest
test
 
ch7-clean.ppt
ch7-clean.pptch7-clean.ppt
ch7-clean.ppt
 
functional dependency in engineering.pptx
functional dependency in engineering.pptxfunctional dependency in engineering.pptx
functional dependency in engineering.pptx
 
DBMS 3.pdf
DBMS 3.pdfDBMS 3.pdf
DBMS 3.pdf
 
Normalisation
NormalisationNormalisation
Normalisation
 
Function Dependencies and Normalization
 Function Dependencies and Normalization Function Dependencies and Normalization
Function Dependencies and 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
 
Unit05 dbms
Unit05 dbmsUnit05 dbms
Unit05 dbms
 
UNIT-IV.ppt
UNIT-IV.pptUNIT-IV.ppt
UNIT-IV.ppt
 
UNIT 2 -PPT.pptx
UNIT 2 -PPT.pptxUNIT 2 -PPT.pptx
UNIT 2 -PPT.pptx
 
Functional Dependency
Functional DependencyFunctional Dependency
Functional Dependency
 
7. Relational Database Design in DBMS
7. Relational Database Design in DBMS7. Relational Database Design in DBMS
7. Relational Database Design in DBMS
 
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
 
Lesson 2 1
Lesson 2 1Lesson 2 1
Lesson 2 1
 
DBMS-Normalization.ppt
DBMS-Normalization.pptDBMS-Normalization.ppt
DBMS-Normalization.ppt
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 

Recently uploaded

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 

Functional dependency

  • 1. Functional Dependencies R L D D Rajapaksha Diploma in Software Application Development Wayamba University of Sri Lanka, Kuliyapitiya 13 May 2018
  • 2. 2 Functional Dependencies…? • Functional Dependency (FD) is a constraint that describes the relationship between attributes in the relation (table). • FDs and Keys are used to define the normal forms for relations.
  • 3. 3 Functional Dependencies…? (cont…) Definition : Relation schema: R {A1,A2,...,An} X , Y are subsets of R If R: X Y then, If t1[X]=t2[X] then, t1[Y]=t2[Y] in any relation instance r(R) R t2 t1 YX
  • 4. 4 Examples for FD constraints.
  • 5. 5 Examples for FD constraints. • Student ID determines Student name and Birth date. StID  {StName, Bdate} • Sport Name determines type of sport. SpName  type • Student ID and Sport Name determine the hours per week that the student practices his sport. {StID, SpName}  hours
  • 6. 6 Functional Dependencies…? (cont…) • A FD is a property of attributes in the relational schema R (intension). • If L is a key of the relation R, it determines all the attributes of R.
  • 7. 7 Inference Rules for FDs. • Armstrong's inference rules A1. (Reflexive) If Y subset-of X, then X  Y A2. (Augmentation) If X  Y, then XZ  YZ (Notation: XZ stands for X U Z) A3. (Transitive) If X  Y and Y  Z, then X  Z Go back Slide 14
  • 8. 8 Additional Useful Inference Rules. • Decomposition If X  YZ, then X  Y and X  Z • Union If X  Y and X  Z, then X  YZ • Psuedotransitivity If X  Y and WY  Z, then WX  Z
  • 9. 9 Types of Functional Dependencies. 1. Trivial Functional Dependency. 2. Non-Trivial Functional Dependency. 3. Multi-valued Dependency. 4. Transitivity Dependency.
  • 10. 10 1. Trivial Functional Dependency. • The dependency of an attribute on a set of attributes is known as trivial functional dependency if the set of attributes includes that attribute. If B is a subset of A then, ABB AA BB A B
  • 11. 11 2. Non-Trivial Functional Dependency. • If a functional dependency X->Y holds true where Y is not a subset of X If B is not a subset of A then, AB A B
  • 12. 12 3. Multi-valued Dependency. • If there are more than one independent multi-valued attributes in a relation, that is called “multi-valued dependency”. bike_model manf_year colour V001 2011 Black V001 2011 Blue V002 2012 Black V002 2012 Blue V003 2013 Black V003 2013 Blue bike_model ->> manf_year bike_model ->> colour
  • 13. 13 4. Transitivity Dependency. • A functional dependency is said to be transitive if it is indirectly formed by two functional dependencies. Transitive dependency: XZ; if the following three functional dependencies hold TRUE, XY Y does not X YZ • Can only occur in a relation of three or more attributes. • Helps to normalizing the DB in 3NF.
  • 14. 14 Example_Transitivity Dependency. Book Author Author_Age ABC Nimal Bandara 48 XY Sakunthala Weerasinghe 36 MNO Nimal Bandara 48 {Book}  {Author} {Author} does not  {Book} {Book} { Author_Age} Therefore Transitive Dependency is; {Book}  {Author_Age} ; inference rules
  • 15. 15 Closure of Functional Dependency. Closure of a set (X+) is the set of attributes functionally determined by X. Let S be the set of functional dependencies on relation R. Let X is set of attributes that appear on left hand side of some FD in S and we want to determine the set of all attributes that are dependent on X. Thus for each such set of attribute X, we determine the set X+ of attributes that are functionally determined by X based on S, X+ is called closure of X under S -www.edugrabs.com-
  • 16. 16 Example_Closure of Functional Dependency. Closure of A (A+) A+ = A A(BC) ; from (1) AB(CD)C ; from (2) ABCDC = ABCD So, A+ = ABCD A B C D Functional Dependencies: (1); A  BC (2); B  CD
  • 17. 17 Applications_Closure of Functional Dependency. • It is used to identify the additional FDs. • It is used to identify keys(CKs and SKs). • It is used to identify the Prime and Non-Prime Attributes. • It is used to identify equivalence of FD.