## Functional Dependency with Examples-

- A
**Functional dependency**is a relationship between attributes. Suppose that given the value of one attribute, we can obtain the value of another attribute. - For example, if we know the value of customer account number, we can obtain customer address, balance etc. By this, we say that

customer address and balance is functionally dependent on customer account number. - In
**general terms**, attribute Y(customer address and balance) is functionally dependent on the attribute X(customer account number), if the value of X determines the value of Y. - Functional dependency is
**represented**by an**arrow sign (→)**that is, X→Y, where X functionally determines Y. The left-hand side attributes determine the values of attributes on the right-hand side. Attributes on the left side are called**Determinants.**

**Let us consider a relation**

Item Price(P) |
Number of Items(N) |
Total Price=P*N |

100 | 10 | 1000 |

200 | 10 | 2000 |

300 | 10 | 3000 |

400 | 10 | 4000 |

**Total Price = Item Price * Number of Items**

In this case, Total Price is functionally dependent on Item Price and Number Of Items.

Functional Dependencies are written using the following notation:

(Item price, Number of Items) → Total Price

Consider another relation R(S#,STATUS,CITY,P#,QTY)

S# |
STATUS |
CITY |
P# |
QTY |

S001 | 10 | Ujjain | P001 | 105 |

S001 | 10 | Ujjain | P002 | 130 |

S001 | 10 | Ujjain | P003 | 125 |

S001 | 10 | Ujjain | P004 | 200 |

S002 | 30 | Surat | P001 | 115 |

S002 | 30 | Surat | P002 | 120 |

S003 | 40 | Rohtak | P001 | 300 |

S004 | 10 | Ujjain | P004 | 400 |

S004 | 10 | Ujjain | P005 | 400 |

R relation hold following Functional Dependencies :

S# → CITY S# → STATUS CITY → STATUS (S#,P#) → QTY

Figure 1 shows the functional dependency diagram for the relation R.

#### Properties of Functional Dependency –

- The Functional Dependency will deal with one to one relationship among the attributes, some times it may be one to many or many to one relationships
- Functional Dependency must be defined on schema, not on instance of the schema. For example,

ab → cd a → b ab → c etc.

- A Functional Dependency must be a non trivial/semi non trivial or completely non trivial. It does not be trivial. A trivial Functional Dependency is the one where RHS is a subset of LHS.

Example of Trivial Functional Dependency – abc → bc - A Functional Dependency is non trivial if atleast one of the RHS attributes are not part of the LHS attributes.

A Functional Dependency is completely non trivial if none of the RHS attributes are part of the LHS attributes.

Example of Non Trivial – abc → cde

Example of Complete Non Trivial – abc → def.

Previous | Home | Next |

Advantages and Disadvantages of ER Model |
Types of Functional Dependency with Example |

### Incoming search terms:

- function dependency in edugrab com