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
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.
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
- Reflexivity: If
, then
- These are called trivial functional dependencies
- Augmentation: If
, then for any set of attributes - Transitivity: If
and , then
Closure
Given a set of functional dependencies
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