Functional Dependency

Functional Dependency

Functional Dependency

What is Functional Dependency?

In the context of relational databases, a functional dependency expresses the relationship between two attributes. If attribute S functionally determines attribute T, it is denoted as:

S → T

In this notation, S is known as the determinant, and T is the dependent. This means that the value of attribute T is determined by the value of S. More formally, for any two rows in a table, if the value of S is the same, then the value of T must also be the same.

Machine Learning Tutorial:-Click Here
Data Science Tutorial:-Click Here
Complete Advance AI topics:- CLICK HERE
Deep Learning Tutorial:- Click Here

Example:

Consider a table named Employee with the following attributes:

  • Emp_Id
  • Emp_Name
  • Emp_Address

Here, Emp_Id can uniquely identify each employee’s name and address. This gives rise to the following functional dependencies:

  • Emp_Id → Emp_Name
  • Emp_Id → Emp_Address

This indicates that Emp_Name and Emp_Address are functionally dependent on Emp_Id.

Types of Functional Dependencies

1. Trivial Functional Dependency

A functional dependency A → B is trivial if B is a subset of A.

Example:

In a table with attributes {Employee_Id, Employee_Name}:

  • {Employee_Id, Employee_Name} → Employee_Id is trivial because Employee_Id is a subset of the left-hand side.
  • Employee_Id → Employee_Id and Employee_Name → Employee_Name are also considered trivial.

2. Non-Trivial Functional Dependency

A functional dependency A → B is non-trivial if B is not a subset of A.

Example:

  • ID → Name is non-trivial because Name is not part of the ID.
  • Name → DOB is also non-trivial.

If the intersection of A and B is empty, the dependency is called completely non-trivial.

Armstrong’s Axioms

To understand and work with functional dependencies, Armstrong’s Axioms provide a set of inference rules. Introduced by William Armstrong in 1974, these rules help derive all possible functional dependencies from a given set.

1. Reflexivity

If T is a subset of S, then S → T holds.
Example: {Emp_Id, Emp_Name} → Emp_Id

2. Augmentation

If S → T, then SR → TR also holds, where R is an additional attribute.
Example: If Emp_Id → Emp_Name, then {Emp_Id, Dept} → {Emp_Name, Dept}

3. Transitivity

If S → T and T → U, then S → U.
Example: If Emp_Id → Dept and Dept → Manager, then Emp_Id → Manager

Advantages of Functional Dependency in DBMS

1. Ensures Data Accuracy

Functional dependencies help maintain data integrity by enforcing rules that prevent the insertion of inconsistent data into the database.

2. Supports Normalization

Functional dependencies are essential in the normalization process. By identifying dependencies, large tables can be decomposed into smaller, well-structured tables, reducing redundancy and anomalies.

3. Enables Efficient Storage

By organizing data through normalization based on functional dependencies, databases become more storage-efficient. Smaller, well-defined tables use less space and are easier to manage.

4. Simplifies Maintenance

Databases that follow well-defined functional dependencies are easier to maintain. Changes in the schema have limited impact, reducing the risk of errors and making updates more manageable.

Complete Python Course with Advance topics:-Click Here
SQL Tutorial :-Click Here

Download New Real Time Projects :-Click here

Final Thoughts

Understanding functional dependency is crucial for anyone working with relational databases. It lays the foundation for data normalization, which leads to more efficient, consistent, and reliable databases. Whether you’re a student, developer, or database designer, mastering this concept will help you design better data models.

For more insightful DBMS topics, keep following UpdateGadh — your source for smart, simplified tech content.


functional dependency in dbms
functional dependency example
types of functional dependency in dbms
functional dependency diagram
full functional dependency
functional dependency in dbms pdf
fully functional dependency in dbms
functional dependency in dbms with example
normalization in dbms
transitive dependency
functional dependency in dbms example

    Share this content:

    Post Comment