Functional Dependencies
Functional Dependencies and Relational Schema Design
Functional dependencies
A functional dependency (FD) expresses a constraint between sets of attributes in a relation. An FD written as α→β means that the values of attributes in α determine the values of attributes in β.
More precisely, in every valid instance of the relation, any two tuples that agree on all attributes in α must also agree on all attributes in β. The constraint applies to every valid instance of the schema, not just to one observed dataset.
For example, if A→B and B→C, then A determines C: tuples that agree on A must agree on B, and therefore must agree on C.
Armstrong’s axioms and the closure of functional dependencies
Armstrong’s axioms are a sound and complete set of rules for deriving functional dependencies from a given set F.
Reflexivity: If β⊆α, then α→β. This captures dependencies that hold simply because the right-hand attributes are already among the left-hand attributes.
Augmentation: If α→β, then αγ→βγ for any set of attributes γ. Adding the same attributes to both sides preserves the dependency.
Transitivity: If α→β and β→γ, then α→γ.
The closure of a set of functional dependencies, written F+, is the set of all dependencies logically implied by F. It includes the original dependencies and every dependency that can be derived from them.
Because the schema has finitely many attributes, only finitely many distinct dependencies can be formed. A procedure that repeatedly applies Armstrong’s axioms must eventually stop: it terminates when no new dependencies can be added to F+.
A direct closure procedure
A simple, though potentially inefficient, method is:
Initialize the current set with F.
Apply reflexivity and augmentation to individual dependencies.
Apply transitivity to pairs of dependencies where the right side of one can connect to the left side of another.
Add any newly derived dependencies.
Repeat until the set no longer changes.
This procedure illustrates how dependencies accumulate through repeated inference. More efficient methods are useful in practice, but the closure provides a precise account of everything implied by F.
Derived rules
Several useful rules follow from Armstrong’s axioms. They are sound—they derive only dependencies that hold—but they are not needed as additional axioms because they can be proved from the original three.
Union: If α→β and α→γ, then α→βγ. A common left side can determine the union of the right sides.
Decomposition: If α→βγ, then both α→β and α→γ. A dependency on a set of attributes implies a dependency on each subset.
Pseudotransitivity: If α→β and γβ→δ, then γα→δ.
For example, union follows because tuples that agree on α must agree on both β and γ‘,andthusontheirunion.Itcanalsobederivedfromtheaxioms:augment\alpha \to \betawith\alpha,obtaining\alpha \to \alpha\beta;augment\alpha \to \gammawith\beta,obtaining\alpha\beta \to \beta\gamma$; then apply transitivity.
Attribute closure
The closure of an attribute set α with respect to F, written α+, is the set of all attributes that can be functionally determined by α using the dependencies in F.
The attribute closure is always relative to a specified set of functional dependencies. In other words, α+ means the attributes implied by α under the dependencies currently being considered.
Computing an attribute closure
A straightforward algorithm is:
Initialize the result to α, since every attribute in α is determined by α.
For each dependency β→γ in F, check whether β is already contained in the result.
If it is, add γ to the result.
Repeat until no attributes can be added.
The logic is that if β is already determined by α, and β→γ, then transitivity implies that α determines γ as well.
Example
Suppose the relation has attributes A,B,C,G,H,I, and the dependencies include:
A→B
A→C
CG→H
CG→I
To compute (AG)+:
Start with {A,G}.
Since A determines B and C, add B and C.
The result now contains both C and G, so it contains the left side of CG→H and CG→I. Add H and I.
No further attributes can be added.
Thus, (AG)+={A,B,C,G,H,I} for this set of dependencies. If these are all the attributes of the relation, then AG is a superkey.
Uses of attribute closure
Attribute closure is a practical tool for several common questions.
Testing for a superkey: A set α is a superkey if α+ contains every attribute of the relation.
Testing whether an FD follows from F: The dependency α→β holds if and only if β⊆α+.
Finding candidate keys: First find sets whose closures cover the entire relation. Then test whether any attributes can be removed while preserving that property.
A candidate key is a minimal superkey: it determines every attribute, but no proper subset of it does.
Testing whether AG is a candidate key
In the example, (AG)+ contains every attribute, so AG is a superkey. To check minimality, test the proper subsets:
A+ contains A,B,C,H if the dependencies include A→B, A→C, and B→H. It does not contain G or I, so A is not a superkey.
If G does not occur on the right side of any dependency, then starting from G cannot derive the other attributes, so G alone is not a superkey.
Since neither single-attribute subset is a superkey, AG is minimal and therefore is a candidate key.
Computing F+ using attribute closures
Attribute closures can also be used to determine the closure of a dependency set. For each attribute set X in the relation, compute X+. Every attribute Y in X+ gives a dependency X→Y in F+. Considering all possible sets X produces the dependencies implied by F.
Boyce–Codd normal form
Boyce–Codd Normal Form (BCNF) is a condition for reducing redundancy in a relational schema. A relation must first satisfy first normal form. It is in BCNF with respect to F if, for every dependency α→β in F+, at least one of these holds:
The dependency is trivial, meaning β⊆α.
The left side α is a superkey for the relation.
A nontrivial dependency whose left side is not a superkey violates BCNF. The key idea is that, in BCNF, every nontrivial determinant must be powerful enough to identify an entire tuple.
Example: instructor and department information
Consider a relation containing:
Instructor ID
Instructor name
Salary
Department name
Building
Budget
Suppose the dependencies include:
Instructor ID → instructor name, salary, department name
Department name → building, budget
The second dependency violates BCNF in the combined relation: department name determines building and budget, but department name is not a superkey for the whole relation.
A decomposition separates the information into:
An instructor relation containing instructor ID, name, salary, and department name.
A department relation containing department name, building, and budget.
The instructor ID determines the other attributes in the instructor relation, and department name determines the other attributes in the department relation. Each nontrivial dependency in these relations has a superkey on its left side, so both are in BCNF.
General decomposition for a BCNF violation
For a violating dependency α→β, the standard decomposition creates:
R1=α∪β
R2=R−(β−α)
Here, β−α means the attributes on the right side that are not already on the left. Those attributes are separated into R1, while the common determinant attributes remain in the other component.
The procedure is repeated on any resulting relation that still violates BCNF.
Lossless-join decomposition
A decomposition is lossless if the original relation can be reconstructed exactly by joining the decomposed relations. For every valid instance of the original schema, joining the corresponding component instances must produce precisely the original tuples—no missing information and no spurious combinations.
For a binary decomposition of R into R1 and R2:
Their attributes must cover the original schema: R1∪R2=R.
The common attributes are R1∩R2.
Under the dependencies, the common attributes must functionally determine all attributes of at least one component. Equivalently, the common attributes must be a superkey of at least one component.
A common set that is a key in one component identifies at most one matching tuple there. This prevents the natural join from combining one tuple with multiple incompatible tuples and producing spurious results.
In the instructor–department decomposition, the common attribute is department name. It is a key of the department relation because it determines building and budget. The join can therefore recover department information for each instructor without introducing extra combinations.
Dependency preservation
A decomposition is dependency-preserving if the original dependencies can be checked using the decomposed relations, without first joining them back together.
This matters because checking a dependency by joining large relations can be expensive. A good design therefore aims to keep each dependency verifiable in one or more individual components. The instructor–department decomposition preserves the dependencies: the instructor ID dependency can be checked in the instructor relation, and the department-name dependency can be checked in the department relation.
BCNF does not always preserve dependencies
Consider a relation with attributes:
C: city
S: street
Z: ZIP code
Suppose the dependencies are CS→Z and Z→C. The set CS is a key. The dependency CS→Z satisfies BCNF because its left side is a key. However, Z→C violates BCNF: Z is not a superkey for the whole relation.
Decomposing on Z→C gives:
R1(Z,C)
R2(S,Z)
The common attribute is Z. In R1, Z determines C and itself, so it is a key of that component. The decomposition is lossless.
However, the dependency CS→Z involves all three attributes and cannot be checked in either component alone. Checking it requires joining the components to reconstruct the original relation. Thus, this decomposition is lossless but does not preserve all dependencies.
This example shows that BCNF guarantees neither dependency preservation in every decomposition nor the ability to check every original dependency locally.
Third normal form
Third Normal Form (3NF) relaxes BCNF in a way that can allow dependency preservation. For every dependency α→β in F+, 3NF requires at least one of the following:
The dependency is trivial.
α is a superkey.
Every attribute in β−α is part of at least one candidate key.
An attribute that belongs to at least one candidate key is called a prime attribute. Different attributes in β−α may belong to different candidate keys; they do not all have to belong to the same key.
Every BCNF relation satisfies 3NF, because it satisfies the first two conditions. The converse is not always true: 3NF permits some dependencies whose left side is not a superkey, provided the right-side attributes are prime. This relaxation helps retain dependencies during decomposition.
Goals and trade-offs in normalization
Normalization aims to organize relational schemas so that their structure represents information reliably and avoids unnecessary redundancy. When a schema is not adequately structured, it can be decomposed into smaller relations.
A desirable decomposition aims for:
Lossless reconstruction: The original information can be recovered exactly.
Dependency preservation: Constraints can be checked without expensive joins.
Reduced redundancy: Facts are stored in appropriate places rather than repeatedly.
Acceptable query cost: Common queries do not become unnecessarily expensive.
These goals can conflict. Decomposition can reduce redundancy and eliminate anomalies, but queries that previously used one relation may now require joins. Conversely, keeping information together may make some queries cheaper while creating repeated data and update problems. Schema design must balance the costs of redundancy, constraint checking, reconstruction, and query execution.
BCNF does not address every kind of redundancy
BCNF is based on functional dependencies, but not all problematic redundancy is caused by functional dependencies.
Suppose an instructor can have multiple children and multiple phone numbers, and these facts are independent of one another. A relation containing instructor ID, child name, and phone number may need one tuple for every child–phone combination. For instance, two children and two phone numbers may require four tuples even though the child facts and phone facts are independent.
This creates redundancy and anomalies:
Insertion anomaly: Adding one phone number may require multiple tuples because the instructor has multiple children.
Update anomaly: Changing a phone number may require updates to several tuples.
Unnecessary combinations: The relation records child–phone pairings even when the facts are independently associated with the instructor.
There may be no nontrivial functional dependency that captures these independent multiple-valued facts. The relation can therefore satisfy BCNF while still containing serious redundancy. Separating child information and phone information into their own relations can remove the repeated combinations. This kind of problem motivates higher normal forms, including Fourth Normal Form (4NF), which addresses multivalued dependencies rather than only functional dependencies.
Key takeaways
F+ contains all functional dependencies implied by F; Armstrong’s axioms provide a sound and complete basis for deriving them.
The attribute closure α+ supports key identification and tests whether α→β follows from F.
BCNF requires every nontrivial dependency to have a superkey on the left.
A decomposition should be lossless so that joining its components recovers exactly the original information.
Dependency preservation allows constraints to be checked without reconstructing the original relation.
BCNF decomposition can be lossless yet fail to preserve dependencies.
3NF allows a controlled relaxation of BCNF when right-side attributes are prime.
Functional-dependency-based normal forms do not eliminate every form of redundancy; independent multivalued facts can require higher normal forms.

Ask anything
We've read this whole study set, so questions about it get the best answers.