Saturday, 5 February 2022

Functional Dependency in DBMS

 Functional dependencies are the relationships among the attributes within a relation. Functional dependencies provide a formal mechanism to express constraints between attributes.

Notation of Functional Dependency

The notation of functional dependency is A −→ B. The meaning of this notation is:

1. “A” determines “B”
2. “B” is functionally dependent on “A”
3. “A” is called determinant
“B” is called object of the determinant


If attribute A functionally depends on attribute B, then for every instance of B you will know the respective value of A.

Attribute “B” is functionally dependent upon attribute “A” (or collection of attributes) if a value of “A” determines or single value of attributes “B” at only one time.

Functional dependency helps to identify how attributes are related to each other.

For example consider the following table 


In the above table A->B is FD but not B->A.

Compound Determinants

More than one attribute is necessary to determine another attribute in an entity, and then such a determinant is termed as composite determinant.

For example, the internal marks and the external marks scored by the student determine the grade of the student in a particular subject.

Internal mark, external mark→grade.

Since more than one attribute is necessary to determine the attribute grade it is an example of compound determinant.

 Types of Functional Dependency 

The following are the different types of Functional Dependencies 

1. Trivial Functional Dependency.

If X->Y is Functional Dependency and 'Y' is a subset of 'X' then this Functional Dependency is Trivial Functional Dependency .

Example:

  1. AB->A ; Here 'A' is subset of 'AB'
  2. MNP->MP; Here 'MP' is subset of 'MNP'
  3. ZX->Null set; is also Trivial
  4. A->A; is also Trivial 

2. Non-Trivial Functional Dependency.

 If X->Y is Functional Dependency and 'Y' is not a subset of 'X' then this Functional Dependency is Non-Trivial Functional Dependency .

Example: AB->C

3. Semi-Trivial Functional Dependency.

Some part of the dependent is some part of the determinant, such type of FD is called Semi-Trivial Functional Dependency.

Example: ABC->BCD

This type of FD can be handled by two methods

a) on delete cascade: It will delete the tuple from "Referencing Relation" ( the tuple that contain primary key) if value used by referencing attribute is deleted from referenced relation.

b) on update cascade : It will update the referencing attribute in referencing relation if attribute value used by referencing attribute is updated in referenced relation. 

0 comments:

Post a Comment

Note: only a member of this blog may post a comment.

Find Us On Facebook

Computer Basics

More

C Programming

More

Java Tutorial

More

Data Structures

More

MS Office

More

Database Management

More
Top