Functional dependency

from Wikipedia, the free encyclopedia

Functional dependencies (FA) are a concept of relational design theory and form the basis for the normalization of relation schemes .

A relation is defined by attributes. If some of these attributes clearly determine the values ​​of other attributes, one speaks of functional dependency. For example, one could imagine a customer database in which the address and telephone number of a customer are clearly identified by their name and date of birth. Here the address and telephone number would functionally depend on the name and date of birth.

The term key can also be defined with the help of functional dependencies :

If some attributes of a relation uniquely determine the values ​​of all attributes of the relation, one speaks of a super key , that is, every tuple of this relation is uniquely determined by the values ​​of these attributes. For example, one could introduce a customer number that identifies each customer. A key candidate is a minimal super key , that is, no real subset of the attributes of this key completely determines the values ​​of all other attributes of the relation. A so-called primary key is selected from all key candidates in a relation .

Example:

A. B. C.
1 1 3
1 1 3
1 2 4th

In this example, C is functionally dependent on A and B, written A, B → C. The arrow can thus be read as "definitely unambiguous": The first two attributes together uniquely determine which value attribute C has. In other words: if you know which values ​​the first two attributes have, this also determines the value of the last attribute. So C is not functionally dependent on A alone, nor on B alone, but on the combination of A and B.

Formal definition

Let be a relation with the relation schema and let and be subsets of attributes of . Be a tuple . Then the restriction is on the attributes . The functional dependency ( is functionally dependent on ) applies if the following applies to every admissible relation :

This means that for all tuples with the same -attributes ( ) it also applies that their -attributes are the same ( ). The values ​​of the attributes from the attribute set clearly determine the values ​​of the attributes from the attribute set ; is also referred to in the literature as the determinant for . For attribute sets one usually writes briefly instead of .

is fully functionally dependent on when out can be removed no attribute, so that the condition still applies.

In the example above the attribute plays for the determination of no difference:

The full functional dependency can be obtained from the functional dependency .

Armstrong's axioms

With the help of the axioms of Armstrong (Armstrong also axioms) can be from a set of functional dependencies that apply to a relation, derive further functional dependencies. The following three rules are sufficient to infer all functional dependencies:

1. A set of attributes uniquely determines the values of a subset of these attributes (trivial dependence), ie . ( Reflexivity )

2. If this applies , then also applies to any set of attributes of the relation. (Expansion rule, reinforcement)

3. If and , then also applies . (Transitivity rule)

In order to make derivations easier, the following (derived) rules can also be used:

4. If and , then also applies . (Union rule)

5. Applies so apply and . (Decomposition / disassembly rule)

6. If and , then also applies . (Pseudotransitivity rule)

Normalization with functional dependencies

Relation schemes can be normalized with the help of functional dependencies . A relation scheme is, for example, in Boyce-Codd normal form if the following applies to all functional dependencies that apply to: The functional dependency is trivial or is a super key for . The 3rd normal form is somewhat weakened. One of the conditions specified above must apply to them or that all attributes from are contained in at least one of the key candidates of .

There are algorithms that break down a relational scheme into normalized schemes on the basis of functional dependencies. The aim of such a decomposition is losslessness and dependency loyalty (also dependency preservation) of the decomposition. Dependency loyalty means that all functional dependencies that apply to the original relation still apply to the decomposition. One such algorithm that transfers to the third normal form is the synthesis algorithm . The losslessness of a decomposition into two partial relations can be demonstrated with the help of Delobel's theorem .

Attribute envelope

The attribute shell of a certain attribute is a set of all attributes that functionally depend on. In the smallest case, the attribute envelope is only the attribute itself, since no other attributes depend on it. If one wants to determine the attribute envelope of an attribute for a given number of functional dependencies F, one can apply a simple algorithm that determines the set of dependent attributes by repeatedly applying the transitivity rule. The algorithm is defined as follows:

Input :

  • a lot of functional dependencies
  • a lot of attributes

Output :

  • the complete set of attributes that can be derived from the dependencies . It applies .

 Envelope while (change to ) do foreach (dependency ) do if ( )  then
   
   
      
        

Applied to a concrete set of functional dependencies F:

  • F has the dependencies:
  • We want to determine the attribute envelope for .

1.

2. Run through the functional dependencies from top to bottom:

    • is not a subset of
    • is not a subset of
    • is a subset of
    • is a subset of
    • New run:
    • is a subset of
    • ... after that nothing changes in the amount

Completed shell

Intuitively speaking, the closed shell of a set of functional dependencies is the set of attributes that is determined by the “left sides” of the dependencies.

If F = {α 1 → β 1 , ..., α n → β n } is a set of functional dependencies, then the closed envelope or attribute envelope is the set

and is denoted by. The following applies to the envelope:

Advanced concepts

  • Multi-valued dependencies form an extension of the functional dependencies that make it possible to uncover additional anomalies in a relational schema.
  • Conditional dependencies (engl. Conditional Functional Dependencies) form an extension of the functional dependencies to specific tables of values. A dependency such as PLZOrtis expanded to include an additional table with specific values ​​such as 80001München. The postcode 80001 is assigned directly to Munich . With the help of these conditional dependencies, the quality of data can be measured or measures to improve the data quality can be derived.

See also

literature

  • Alfons Kemper, André Eickler: Database systems. An introduction. Oldenbourg, Munich 2004, ISBN 3-486-27392-2 .
  • Philip Bohannon, Fan Wenfei, Floris Geerts, Jia Xibei, Anastasios Kementsietsidis: Conditional Functional Dependencies for Data Cleaning. IEEE Service Center, Piscataway NJ 2007.

Web links