# Multivalued dependency

In database theory, a multivalued dependency is a full constraint between two sets of attributes in a relation.

In contrast to the functional dependency, the multivalued dependency requires that certain tuples be present in a relation. Therefore, a multivalued dependency is a special case of tuple-generating dependency. The multivalued dependency plays a role in the 4NF database normalization.

A multivalued dependency is a special case of a join dependency, with only two sets of values involved, i.e. it is a binary join dependency.

A multivalued dependency exists when there are at least 3 attributes (like X,Y and Z) in a relation and for value of X there is a well defined set of values of Y and a well defined set of values of Z. However, the set of values of Y is independent of set Z and vice versa.

## Formal definition

The formal definition is given as follows. [1]

Let ${\displaystyle R}$ be a relational schema and let ${\displaystyle \alpha \subseteq R}$ and ${\displaystyle \beta \subseteq R}$ (subsets). The multivalued dependency
${\displaystyle \alpha \twoheadrightarrow \beta }$
(which can be read as ${\displaystyle \alpha }$ multidetermines ${\displaystyle \beta }$) holds on ${\displaystyle R}$ if, in any legal relation ${\displaystyle r(R)}$, for all pairs of tuples ${\displaystyle t_{1}}$ and ${\displaystyle t_{2}}$ in ${\displaystyle r}$ such that ${\displaystyle t_{1}[\alpha ]=t_{2}[\alpha ]}$, there exist tuples ${\displaystyle t_{3}}$ and ${\displaystyle t_{4}}$ in ${\displaystyle r}$ such that
${\displaystyle t_{1}[\alpha ]=t_{2}[\alpha ]=t_{3}[\alpha ]=t_{4}[\alpha ]}$
${\displaystyle t_{3}[\beta ]=t_{1}[\beta ]}$
${\displaystyle t_{3}[R-\beta ]=t_{2}[R-\beta ]}$
${\displaystyle t_{4}[\beta ]=t_{2}[\beta ]}$
${\displaystyle t_{4}[R-\beta ]=t_{1}[R-\beta ]}$

In more simple words the above condition can be expressed as follows: if we denote by ${\displaystyle (x,y,z)}$ the tuple having values for ${\displaystyle \alpha ,}$ ${\displaystyle \beta ,}$ ${\displaystyle R-\alpha -\beta }$ collectively equal to ${\displaystyle x,}$ ${\displaystyle y,}$ ${\displaystyle z,}$ correspondingly, then whenever the tuples ${\displaystyle (a,b,c)}$ and ${\displaystyle (a,d,e)}$ exist in ${\displaystyle r}$, the tuples ${\displaystyle (a,b,e)}$ and ${\displaystyle (a,d,c)}$ should also exist in ${\displaystyle r}$.

## Example

Consider this example of a relation of university courses, the books recommended for the course, and the lecturers who will be teaching the course:

University courses
Course Book Lecturer
AHA Silberschatz John D
AHA Nederpelt John D
AHA Silberschatz William M
AHA Nederpelt William M
AHA Silberschatz Christian G
AHA Nederpelt Christian G
OSO Silberschatz John D
OSO Silberschatz William M

Because the lecturers attached to the course and the books attached to the course are independent of each other, this database design has a multivalued dependency; if we were to add a new book to the AHA course, we would have to add one record for each of the lecturers on that course, and vice versa.
Put formally, there are two multivalued dependencies in this relation: {course} ${\displaystyle \twoheadrightarrow }$ {book} and equivalently {course} ${\displaystyle \twoheadrightarrow }$ {lecturer}.
Databases with multivalued dependencies thus exhibit redundancy. In database normalization, fourth normal form requires that either every multivalued dependency X ${\displaystyle \twoheadrightarrow }$ Y is trivial or for every nontrivial multivalued dependency X ${\displaystyle \twoheadrightarrow }$ Y, X is a superkey. A multivalued dependency X ${\displaystyle \twoheadrightarrow }$ Y is trivial if Y is a subset of X, or if ${\displaystyle X\cup Y}$ is the whole set of attributes of the relation.

## Properties

• If ${\displaystyle \alpha \twoheadrightarrow \beta }$, Then ${\displaystyle \alpha \twoheadrightarrow R-\beta }$
• If ${\displaystyle \alpha \twoheadrightarrow \beta }$ and ${\displaystyle \gamma \subseteq \delta }$, Then ${\displaystyle \alpha \delta \twoheadrightarrow \beta \gamma }$
• If ${\displaystyle \alpha \twoheadrightarrow \beta }$ and ${\displaystyle \beta \twoheadrightarrow \gamma }$, then ${\displaystyle \alpha \twoheadrightarrow \gamma -\beta }$

The following also involve functional dependencies:

• If ${\displaystyle \alpha \rightarrow \beta }$, then ${\displaystyle \alpha \twoheadrightarrow \beta }$
• If ${\displaystyle \alpha \twoheadrightarrow \beta }$ and ${\displaystyle \beta \rightarrow \gamma }$, then ${\displaystyle \alpha \twoheadrightarrow \gamma -\beta }$

The above rules are sound and complete.

• A decomposition of R into (XY) and (XR − Y) is a lossless-join decomposition if and only if X ${\displaystyle \twoheadrightarrow }$ Y holds in R.
• Every FD is an MVD because if X ${\displaystyle \rightarrow }$ Y, then swapping Y's between tuples that agree on X doesn't create new tuples.
• Splitting Doesn’t Hold. Like FD’s, we cannot generally split the left side of an MVD.But unlike FD’s, we cannot split the right side either, sometimes you have to leave several attributes on the right side.
• Closure of a set of MVDs is the set of all MVDs that can be inferred using the following rules (Armstrong's axioms):
• Complementation: If X ${\displaystyle \twoheadrightarrow }$ Y, then X ${\displaystyle \twoheadrightarrow }$ R - Y
• Augmentation: If X ${\displaystyle \twoheadrightarrow }$ Y and Z ${\displaystyle \subseteq }$ W, then XW ${\displaystyle \twoheadrightarrow }$ YZ
• Transitivity: If X ${\displaystyle \twoheadrightarrow }$ Y and Y ${\displaystyle \twoheadrightarrow }$Z, then X ${\displaystyle \twoheadrightarrow }$ Z - Y
• Replication: If X ${\displaystyle \rightarrow }$ Y, then X ${\displaystyle \twoheadrightarrow }$ Y
• Coalescence: If X ${\displaystyle \twoheadrightarrow }$Y and ${\displaystyle \exists }$ W s.t. W ${\displaystyle \cap }$ Y = ${\displaystyle \emptyset }$, W ${\displaystyle \rightarrow }$ Z, and Z ${\displaystyle \subseteq }$ Y, then X ${\displaystyle \rightarrow }$ Z

## Definitions

full constraint
A constraint which expresses something about all attributes in a database. (In contrast to an embedded constraint.) That a multivalued dependency is a full constraint follows from its definition,as where it says something about the attributes ${\displaystyle R-\beta }$.
tuple-generating dependency
A dependency which explicitly requires certain tuples to be present in the relation.
trivial multivalued dependency 1
A multivalued dependency which involves all the attributes of a relation i.e.${\displaystyle R=\alpha \cup \beta }$. A trivial multivalued dependency implies, for tuples ${\displaystyle t_{1}}$ and ${\displaystyle t_{2}}$, tuples ${\displaystyle t_{3}}$ and ${\displaystyle t_{4}}$ which are equal to ${\displaystyle t_{1}}$ and ${\displaystyle t_{2}}$.
trivial multivalued dependency 2
A multivalued dependency for which ${\displaystyle \beta \subseteq \alpha }$.

## References

1. ^ Silberschatz, Abraham; Korth, Sudarshan (2006). Database System Concepts (5th ed.). McGraw-Hill. p. 295. ISBN 0-07-124476-X.