You are on page 1of 6

Functional Dependency

A functional dependency is a constraint between


two sets of attributes from the database. Suppose
that our relational database schema has n
attributes A1, A2, ..., An. If we think of the whole
database as being described by a single universal
relation schema R = {A1, A2, ... , An}.
A functional dependency, denoted by X→Y,
between two sets of attributes X and Y that are
subsets of R, such that any two tuples t1 and t2 in r
that have t1[X] = t2[X], they must also have t1[Y] =
t2[Y].
Example

The following FDs may hold because the four tuples in the current extension have
no violation of these constraints:

B→C; C→B; {A, B}→C; {A, B}→D; and {C, D}→B

However, the following do not hold because we already have


violations of them in the given extension:

A→B (tuples 1 and 2 violate this constraint);


B→A (tuples 2 and 3 violate this constraint);
D→C (tuples 3 and 4 violate it).
Here in Supplier table
Sno - Supplier number of supplier that is
unique
Sname - Supplier name
City - City of the supplier
Status - Status of the city e.g. A grade
cities may have status 10, B grad
cities may have status 20 and so on.
Here, Sname is FD on Sno. Because, Sname
can take only one value for the given value
of Sno (e.g. S 1) or in other words there
must be one Sname for supplier number
S1.
FD is represented as:
Sno→Sname
FD is shown by → which means that
Sname is functionally dependent on Sno.
Similarly, city and status are also FD on
Sno, because for each value of Sno there
will be only one city and status.
FD is represented as:
Sno→City
Sno→Status
S. Sno→S.(Sname, City, Status)
Fully Functional Dependency
Fully Functional Dependence (FFD) is defined, as Attribute Y is FFD on attribute" X, if it is FD on X and not
FD on any proper subset of X. For example, in relation Supplier, different cities may have the same status.
It may be possible that cities like Amritsar, Jalandhar may have the same status 10.
So, the City is not FD on Status.
But, the combination of Sno, Status can give only one corresponding City ,because Sno" is unique. Thus,
(Sno, Status) → City
It means city is FD on composite attribute (Sno, Status) however City is not fully functional dependent on
this composite attribute, which is explained below:
(Sno, Status) → City
X → Y
Here Y is FD on X, but X has two proper subsets Sno and Status; city is· FD .on one proper subset .of X
i.e. Sno
Sno → City
According to 'FFD definition Y must not be FD on any proper subset of X, but here City is FD in one subset
of X i.e. Sno, so City is not FFD on (Sno, Status)
Consider another case of Shipment table:
Here, Qty is FD on combination of Sno, Pno.
(Sno, Pno) → Qty
X → Y
Here, X has two proper subsets Sno and Pna
Qty is not FD on Sno, because one Supplier can supply more than one quantity.
Qty is also not FD on Pno, because one Product may be supplied many times by different suppliers with
different or same quantities.
So, Qty is FFD and composite attribute of (Sno, Pno) → Qty.
Partial Functional Dependency
A partial functional dependency is a functional
dependency where the determinant consists of
key attributes, but not the entire primary key, and
the determined consist of non-key attributes.
For example, Consider a Relation R(A,B,C,D,E)
having FD : AB → CDE where Primary Key is AB.
Then, { A → C; A → D; A → E; B → C; B → D; B → E
} all are Partial Dependencies.
Transitive Functional Dependency
A transitive functional dependency is a functional
dependency where the determinant consists of
non-key attributes and the determined also
consists of non-key attributes.
For example,
A→B, B→C
Then
A→C

You might also like