Mapping ER Model to Func_model & Functioal Dependencies u2
Mapping ER Model to Func_model & Functioal Dependencies u2
DeptId DeptName
001 Finance
002 Marketing
003 HR
Therefore, the above functional dependency
between DeptId and DeptName can be determined
as DeptName is functionally dependent on DeptId
DeptId -> DeptName
Note: Functional dependency exists between the primary key
and non primary key attribute of a table.
Types of Functional Dependency
Functional dependencies are of the following types.
Trivial FD: A trivial functional dependency is a dependency
where the right-hand side (RHS) is a subset of the left-hand side
(LHS)
Definition:
A functional dependency X→Y is trivial if Y is a subset of X
i.e Y⊆X.
Example:
• Let X={A,B} then
• {A,B}→{A} is trivial also
• {A,B}→{A,B} is trivial.
NonTrivial Functional dependencies
Non-Trivial Functional Dependencies:
A non-trivial functional dependency is one where the RHS is not
a subset of the LHS.
Definition:
A functional dependency X→Y is non-trivial if Y⊈X.
Example:
Given a relation R(A, B, C), suppose:
• A→B, This is non-trivial, because B is not subset of A
Another case is a completely non-trivial FD, where X∩Y=∅,That
means the LHS and RHS share no attributes.
Real life Examples of trivial, nontrivial
and completely nontrivial FD’s
• In order to understand the above topic, Let us take the
example of a relation employee given below:
Transitive FD Example
Scenario: University Student Records
• Relation:
student(student_ID,Department_ID,Department_name)
• Dependencies:
• Student_ID-Department_ID
• Department_id-Department_name
• Therefore, Student_ID- Department_name(Transitive)
Because Student_ID determines Department_name through
Department_ID, not directly.
Non Transitive Functional dependency example:
In the relation :Employee(EmpID, EmpName, Salary)
EmpID → EmpName
EmpID → Salary
Here, both are non-transitive dependencies, because
there is no intermediate attribute involved.
Fully Functional dependency and Partial Functional
dependency
Fully Functional Dependency
A fully functional dependency occurs when an attribute is
functionally dependent on the entire primary key, and not on just a
part of it. This typically occurs in tables where the primary key is
composed of more than one attribute (a composite key).
Example:
Consider a relation:
StudentCourse(StudentID, CourseID, Grade)
Where the primary key is (StudentID, CourseID).
• Grade depends on both StudentID and CourseID
together (i.e., you can’t determine the grade with
just one of them),
Then:
• Grade is fully functionally dependent on the
primary key (StudentID, CourseID).
Partial Dependency:
A partial dependency occurs when an attribute is functionally
dependent on part of a composite primary key, but not on the
whole key.
Example:
Consider a relation:
StudentCourse(StudentID, CourseID, StudentName)
With (StudentID, CourseID) as the primary key.
If:
• StudentName only depends on StudentID (and not
CourseID),
Then:
• StudentName is partially dependent on the primary key.