Functional Dependencies

  • Can be used to identify schemas with such problems and to suggest refinements
  • X A is an assertion about a relation R
  • Read as “X determines A holds in R.”
  • Conventions
    • represent sets of attributes
    • represent single attributes
    • Sets of attributes can be written without set formers: e.g., just , rather than
  • Multiple attributes
    • No need for multiple attributes on the right
      • It can be split using armstrong’s axioms
      • Can still be used as a shorthand for multiple functional dependencies though
    • Multiple attributes on the left might be necessary
  • Where do functional dependencies come from
    • Key constraints on entities and relationships
    • K A holds for R (candidate keys) Superkeys vs. keys
    • many-one, one-one relationships
    • domain knowledge of the application
  • Inferring
    • We are given a set of FD’s , we want to know whether an FD must hold in every relation instance that satisfies the given FD’s in .
    • If so, we say is implied by

Finding Closures

  • A closure contains all of the functional dependencies that implies

Armstrong Axioms

  • Sound and complete inference rules for FDs
  • Core
    • Reflexivity:
    • Augmentation: for any
    • Transitivity:
  • Follows
    • Union:
    • Decomposition:

Closure Test

  • An easier way to test is to compute
    • Linear time algorithm
  • Basis:
  • Inductions: Look for a FD which has a left side that is a subset of the current and right side is not in . If exists, add to

Inference Test

  • Uses Armstrong Axioms
  • To test if , start by assuming two tuples agree in all attributes of
  • Ute the given FDs to infer that these tuples must also agree in certain other attributes
    • If is one of these attributes, is true
    • Otherwise, find a counter example: two tuples, with forced equality of values form a two-tuple relation that proves that does not aollow

Projecting

  • Finding All Implied FD’s on a Projected Schema
  • Useful for decomposition (because all of the decompositions are projections)
  • Basic Idea
    1. Start with given FD’s and find all nontrivial FD’s that follow from the given FD’s.
    2. Restrict to those FD’s that involve only attributes of the projected schema.
  • Simple, exponential algorithm
    1. For each set of attributes , compute
    2. Add for all in
    3. However, drop whenever we discover
      • because follows from in any projection
    4. Finally only include FDs for the projected attributes
  • Tricks
    • No need to compute the closure of the empty set or of the set of all attributes.
    • If we find all attributes, so does the closure of any superset of X.