0% found this document useful (0 votes)
5 views19 pages

Functional Dependency

Notes

Uploaded by

midhulasrikj3053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views19 pages

Functional Dependency

Notes

Uploaded by

midhulasrikj3053
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Functional Dependency

By,
JJ
Definition
• A functional dependency (FD) is a relationship
between two attributes, typically between the
PK and other non-key attributes within a table.
• For any relation R, attribute Y is functionally
dependent on attribute X (usually the PK), if for
every valid instance of X, that value of X
uniquely determines the value of Y.
• X ———–> Y
• Determinant, dependent
Examples
• SIN ———-> Name, Address, Birthdate
• SIN, Course ———> DateCompleted
• ISBN ———–> Title
Rules of Functional Dependencies
R(ABCDE)
Since the values of A are unique (a1, a2, a3,
etc.), it follows from the FD definition that:
• A → B, A → C, A → D, A → E
• It also follows that A →BC (or any other subset
of ABCDE).
• This can be summarized as A →BCDE.
• From our understanding of primary keys, A is a
primary key.
• Since the values of E are always the same (all
e1), it follows that:
• A → E, B → E, C → E, D → E
Other observations:

• Combinations of BC are unique, therefore BC


→ ADE.
• Combinations of BD are unique, therefore BD
→ ACE.
• If C values match, so do D values.
– Therefore, C → D
– However, D values don’t determine C values
– So C does not determine D, and D does not
determine C.
Inference Rules

• Armstrong’s axioms are a set of inference


rules used to infer all the functional
dependencies on a relational database.
• They were developed by William W.
Armstrong.
Armstrong’s axioms/properties of functional dependencies:

• Reflexivity: If Y is a subset of X, then X→Y holds by reflexivity


rule
• For example, {roll_no, name} → name is valid
• Augmentation: If X → Y is a valid dependency, then XZ → YZ
is also valid by the augmentation rule.
• For example, If {roll_no, name} → dept_building is valid,
hence {roll_no, name, dept_name} → {dept_building,
dept_name} is also valid.→
• Transitivity: If X → Y and Y → Z are both valid dependencies,
then X→Z is also valid by the Transitivity rule.
• For example, roll_no → dept_name & dept_name →
dept_building, then roll_no → dept_building is also valid.
Types of Functional dependencies in DBMS:

• Trivial functional dependency


• Non-Trivial functional dependency
• Multivalued functional dependency
• Transitive functional dependency
Trivial functional dependency

• In Trivial Functional Dependency, a


dependent is always a subset of the
determinant.
i.e. If X → Y and Y is the subset of X, then it is
called trivial functional dependency
• For example,
roll_no name age

42 abc 17

43 pqr 18

44 xyz 18

Here, {roll_no, name} → name is a trivial functional


dependency, since the dependent name is a subset of
determinant set {roll_no, name}

Similarly, roll_no → roll_no is also an example of trivial


functional dependency.
Non-trivial Functional Dependency

• example,

roll_no name age


42 abc 17
43 pqr 18
44 xyz 18
Example
• Here, roll_no → name is a non-trivial
functional dependency, since the
dependent name is not a subset
of determinant roll_no
Similarly, {roll_no, name} → age is also a non-
trivial functional dependency, since age is not
a subset of {roll_no, name}
Multivalued Functional Dependency

• In Multivalued functional dependency,


entities of the dependent set are not
dependent on each other.
i.e. If a → {b, c} and there exists no functional
dependency between b and c, then it is called
a multivalued functional dependency.
• For example,
Roll_no name age
42 abc 17
43 pqr 18
44 xyz 18
45 abc 19

Here, roll_no → {name, age} is a multivalued functional dependency, since the


dependents name & age are not dependent on each other(i.e. name → age or age →
name doesn’t exist !)
Transitive Functional Dependency
• In transitive functional dependency,
dependent is indirectly dependent on
determinant.
• i.e. If a → b & b → c, then according to axiom
of transitivity, a → c. This is a transitive
functional dependency

• For example,
Example

enrol_no name dept building_no

42 abc CO 4

43 pqr EC 2

44 xyz IT 1

45 abc EC 2
example
• enrol_no → dept and dept → building_no,
Hence, according to the axiom of
transitivity, enrol_no → building_no is a valid
functional dependency.
• This is an indirect functional dependency,
hence called Transitive functional dependency.
references
• https://opentextbc.ca/dbdesign01/chapter/ch
apter-11-functional-dependencies
/
• https://www.geeksforgeeks.org/types-of-
functional-dependencies-in-dbms/#:~:text=A
%20functional%20dependency%20is
%20a,determining%20the%20value%20of
%20Y.

You might also like