Unit_3
Unit_3
Unit-3
Functional Dependencies
Dr. D. SUDHEER
Assistant Professor
Department of CSE
VNR VJIET (NAAC: A++, NIRF: 113)
Hyderabad, Telangana.
The Problems of Redundancy
⚫ Redundancy: root of several problems
with relational schemas:
◦ redundant storage, insert/delete/update
anomalies
EID Name DeptID DeptName
A01 Ali 12 Wing
EmpDept A12 Eric 10 Tail
A13 Eric 12 Wing
A03 Tyler 12 Wing
What anomalies are associated with EmpDept?
⚫Update Anomalies: If one copy of such repeated data
is updated, an inconsistency is created unless all
copies are similarly updated.
⚫Can we change DeptName of DeptID 12 in the first
tuple? We should repeat the same for all tuples.
⚫ Insertion Anomalies: Cannot insert a department
unless an employee is assigned to it. It may not be
possible to store certain information unless some
other, unrelated, information is stored as well.
⚫Deletion Anomalies: If we delete record of A12 then
the Department 10 no longer exists.
Functional Dependencies: Introduction
Formal Definition:
• Functional dependency in DBMS, as the name suggests
is a relationship between attributes of a table
dependent on each other.
• An FD is trivial if and only if the right side is subset of left side arrow.
Ex1: {S#, P#} -> {S#}
Ex2: {DeptId, DeptName} -> {DeptId}
A -> B
Ex: DeptId -> DeptName
Lossless-join property
It enables us to recover any instance of decomposed
relation from the corresponding instance of the
smaller relations.
• It should be in 1 NF.
• To be in second normal form, a relation must be in first normal form
and relation must not contain any partial dependency.
* X is a super key.
* Y is a prime attribute (each element of Y is
part of some candidate key).
• (STUD_NO, STUD_NAME, STUD_PHONE, STUD_STATE,
STUD_COUNTRY_STUD_AGE) as:
• It should be in BCNF.
• Table should not contain multi valued dependency.