0
0
DbmsConceptBeginner · 3 min read

Functional Dependency in DBMS: Definition and Examples

In a database, a functional dependency means that the value of one attribute (or set of attributes) uniquely determines the value of another attribute. It is written as X → Y, meaning if you know X, you can find Y without ambiguity.
⚙️

How It Works

Imagine you have a list of students with their ID numbers and names. If you know a student's ID, you can find their name easily because each ID is unique. This is the idea behind functional dependency: one piece of information (like the ID) determines another (like the name).

In databases, this helps keep data organized and avoids confusion. If one attribute depends on another, the database can use this rule to ensure data stays consistent and accurate.

💻

Example

This example shows a simple functional dependency in a table of employees.

plaintext
EmployeeID -> EmployeeName

EmployeeID | EmployeeName | Department
-------------------------------------
101        | Alice        | HR
102        | Bob          | IT
103        | Charlie      | Finance

Knowing EmployeeID lets you find EmployeeName uniquely.
Output
If EmployeeID = 102, then EmployeeName = Bob
🎯

When to Use

Functional dependency is used when designing databases to make sure data is stored efficiently and without errors. It helps in database normalization, which organizes tables to reduce duplicate data.

For example, in a school database, knowing a student's ID should always give you their name and class. If this rule is broken, the database might have conflicting or repeated information.

Key Points

  • Functional dependency means one attribute determines another.
  • It is written as X → Y, meaning Y depends on X.
  • It helps keep data consistent and avoid duplication.
  • Used mainly in database normalization and design.

Key Takeaways

Functional dependency means one attribute uniquely determines another in a database.
It is essential for organizing data and avoiding inconsistencies.
Functional dependencies guide database normalization to reduce redundancy.
They are written as X → Y, meaning Y depends on X.
Understanding functional dependency helps design better, reliable databases.