In database theory, functional dependencies (FDs) are a tool to capture semantic relationships between attributes and detect and eliminate bad design.

Informally, a function dependency is when value of attribute X determines the value of attribute Y.

More formally,

Functional dependencies

given a relation and two set of attributes , we say ” functionally determines ” or if each value is associated with precisely one value.

is then said to satisfy the functional dependency . In other word, the relationship between and can be modelled using a function (many-to-one).

Info

Functional dependency shares the same notation to logical implication, and indeed functional dependency can be view as a form of implication. 1

Determining Functional Dependencies

There are two ways to determine functional dependency, either via considering semantic meaning of the attributes or by analyzing the actual data.

In most cases, we use the semantic meaning. And if we use the actual data, this process is referred to as knowledge mining.

Note

We might be able to tell that a certain functional dependency does not hold by just looking at an instance of a relation. However, no matter how many instances of a relation are examined, we can never definitively deduce that a functional dependency does hold purely from data.

This is the same idea as how unit tests can never guarantee eliminating of bugs.

Inference Rules

Given , , and as sets of attributes in a relation , there are several properties of functional dependencies. The most important three are Armstrong’s axioms

  1. Reflexivity: If , then
  • These are called trivial functional dependencies
  1. Augmentation: If , then for any set of attributes
  2. Transitivity: If and , then

Closure

Given a set of functional dependencies , we call the set of all functional dependences that can be deduced form the set a closure and denote it as .

Using the definition of closure, we can say that the Armstrong’s axioms is sound and complete.

  • sound: they generate only functional dependencies in
  • complete: they generate all functional dependencies in

Footnotes

  1. Functional dependency - Wikipedia