Functional Dependencies (FDs)
1. Definition
- A functional dependency (FD) describes a relationship between attributes in a relation.
- If attribute
X
determines attribute Y
, it is written as:
- This means that if two tuples have the same value for
X
, they must have the same value for Y
.
2. Types of FDs
- Trivial FD:
- When
Y
is a subset of X
.
- Example:
{StudentID, Name} → Name
.
- Non-Trivial FD:
- When
Y
is not a subset of X
.
- Example:
StudentID → Name
.
- Fully Functional Dependency:
- All attributes in
X
are necessary to determine Y
.
- Example:
{StudentID, CourseID} → Grade
.
- Transitive Dependency:
- If
X → Y
and Y → Z
, then X → Z
.
- Example:
StudentID → DepartmentID
, DepartmentID → DepartmentName
.
Decomposition Using FDs
1. Purpose of Decomposition
Decomposition breaks a relation into smaller relations to:
- Eliminate redundancy.
- Ensure lossless decomposition.
- Preserve dependencies.