0% found this document useful (0 votes)
54 views23 pages

Lecture 21: - Activity Used: Problem Solving

Here are the steps to find the canonical cover: 1) Apply decomposition rule to WZ->XY to get WZ->X, WZ->Y 2) Compute closures: X+ = WXYZ (from X->W, WZ->XY) WZ+ = WXYZ (from WZ->X, WZ->Y) 3) Y is extraneous in Y->WXZ, remove to get Y->WX 4) The canonical cover is: {X->W, WZ->X, WZ->Y, Y->WX} No further rules can be applied, so this is the canonical cover.
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)
54 views23 pages

Lecture 21: - Activity Used: Problem Solving

Here are the steps to find the canonical cover: 1) Apply decomposition rule to WZ->XY to get WZ->X, WZ->Y 2) Compute closures: X+ = WXYZ (from X->W, WZ->XY) WZ+ = WXYZ (from WZ->X, WZ->Y) 3) Y is extraneous in Y->WXZ, remove to get Y->WX 4) The canonical cover is: {X->W, WZ->X, WZ->Y, Y->WX} No further rules can be applied, so this is the canonical cover.
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/ 23

• Lecture 21

• Activity used: Problem Solving


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.

• Symbolically: A ->B is trivial functional dependency if B is a subset of A.


• The following dependencies are also trivial: A->A & B->B

• For example: Consider a table with two columns Student_id and Student_Name.
• {Student_Id, Student_Name} -> Student_Id is a trivial functional dependency as Student_Id is a
subset of {Student_Id, Student_Name}.  That makes sense because if we know the values of
Student_Id and Student_Name then the value of Student_Id can be uniquely determined.
• Also, Student_Id -> Student_Id & Student_Name -> Student_Name are trivial dependencies too.
Non-Trivial

• If a functional dependency X->Y holds true where Y is not a subset of X then


this dependency is called non trivial Functional dependency.

• For example:
An employee table with three attributes: emp_id, emp_name, emp_address.
The following functional dependencies are non-trivial:
emp_id -> emp_name (emp_name is not a subset of emp_id)
emp_id -> emp_address (emp_address is not a subset of emp_id)
Multivalued dependency

• When existence of one or more rows in a table implies one or more


other rows in the same table, then the Multi-valued dependencies
occur.

• If a table has attributes P, Q and R, then Q and R are multi-valued facts


of P.

• It is represented by double arrow ’->>’


Multivalued Dependencies Example

In the above table, we can see Students Amit and Akash have interest in more than one activity.
This is multivalued dependency because CourseDiscipline of a student are independent of
Activities, but are dependent on the student.
Therefore, multivalued dependency −

StudentName -> CourseDiscipline


StudentName ->-> Activities
Examples

Person->>Mobile
Person->>Food_like
Transitive dependencies
• A functional dependency is said to be transitive if it is indirectly formed by two functional dependencies.
For e.g.
• X -> Z is a transitive dependency if the following three functional dependencies hold true:
• X->Y
• Y does not ->X
• Y->Z

• Example
• {Book} ->{Author} (if we know the book, we knows the author name)
{Author} does not ->{Book}
{Author} -> {Author_age}
• Therefore as per the rule of transitive dependency:
{Book} -> {Author_age}
should hold, that makes sense because if we know the book name we can know the author’s age.
• Functional dependencies

• Types of FD
• Trivial
• No.trivial
• Multivalued
• Trannsitive depen
Closure of a set of functional dependencies
• Given a set F set of functional dependencies, there are certain other functional
dependencies that are logically implied by F .
• The set of all functional dependencies logically implied by F is the closure of
F.
• We denote the closure of F by F +.

• We can find all of F + by applying Armstrong’s Axioms:


• These rules are sound and complete
Closures of attribute set
Uses of attribute set

• To test attribute is a superkey


• If attribute closure of an attribute set contains all attributes of relation,
the attribute set will be super key of the relation.
• To Test attribute or set of attribute is a candidate key
• If no subset of this attribute set can functionally determine all
attributes of the relation, the set will be candidate key as well. For
Example, using FD set of table 1,
• (STUD_NO, STUD_NAME)+ = {STUD_NO, STUD_NAME,
STUD_PHONE, STUD_STATE, STUD_COUNTRY, STUD_AGE}
• (STUD_NO)+ = {STUD_NO, STUD_NAME, STUD_PHONE,
STUD_STATE, STUD_COUNTRY, STUD_AGE}
• To test functional dependency hold or not
• How to check whether an FD can be derived from a given FD set?
• To check whether an FD A->B can be derived from an FD set F,
• Find (A)+ using FD set F.
• If B is subset of (A)+, then A->B is true else not true.
Activity: Problem Solving
• Example: Let R be a relation with attributes W, X, Y, Z and the
functional dependencies:
• W-> Z
• W-> Y
• YZ ->X
• WZ-> Y
• Q: Find all redundant functional dependencies.

• W+= wzyx
Activity: Problem Solving
• Consider a relation R with five attributes V, W, X, Y, and Z. The
following functional dependencies hold:
VY→ W, WX → Z, and ZY → V.
Which of the following is a candidate key for R?
(A) VXZ
(B) VXY
(C) VWXY
(D) VWXYZ
• Lecture 22

• Activity used: Problem Solving


Canonical cover
• Sets of functional dependencies may have redundant dependencies that can be inferred from
the others
For example: A →Cis redundant in: {A→B, B→C}
Parts of a functional dependency may be redundant
E.g.: on RHS: {A→B, B→C, A→CD} can be simplified
• to
• {A→B, B→C, A→D}
• E.g.: on LHS: {A →B, B→C, AC→D} can be simplified
• to
• {A →B, B→C, A→D}
Intuitively, a canonical cover of F is a “minimal ” set of functional dependencies equivalent to
F, having no redundant dependencies or redundant parts of dependencies
To test attribute is extraneous or not
Consider a set F of functional dependencies and the functional dependency α→β in F.

To test if attribute A ∈α is extraneous in α


• 1.compute ({α} –A)+ using the dependencies in F
• 2.check that ({α} –A)+ contains β; if it does, A is extraneous in α

• To test if attribute A∈β is extraneous in β


• 1.compute α+ using only the dependencies in
• F’= (F–{α→β}) ∪{α→(β–A)},
• 2.check that α+ contains A; if it does, A is extraneous in β
• A canonical coverfor Fis a set of dependencies Fc such that
F logically implies all dependencies in Fc,and
Fclogically implies all dependencies in F,and
No functional dependency in Fccontains an extraneous attribute, and
Each left side of functional dependency in Fcis unique.

To compute a canonical cover for F:


• repeat
• Use the union rule to replace any dependencies in F
• α1→β1and α1→β2with α1→β1β2
• Find a functional dependency α→βwith an
• extraneous attribute either in αor in β
• If an extraneous attribute is found, delete it from α→β
• until Fdoes not change
• 􀂄Note: Union rule may become applicable after some extraneous attributes have been deleted, so it has to be re-
applied
Example 1
• Redundant attribute ,extraneous attribute
• 1)step :use decomposition rule at right side only
• 2)compute closure of attribute or set of attribute for attribute in each FD
with functional dependency and without functional dependency
• R(A,B,C)
• A->BC
• B->C
• A->B
• AB->C
Example 2 (Activity: Problem solving)
• R(W X Y Z)
• X->W
• WZ->XY
• Y->WXZ

You might also like