Functional Dependencies
Let
A functional dependency over the Attributes of
- We say that set of attributes X functionally determines the set of attributes Y in
- Usually forms a relation schema with its set of attributes
Example
Employee SIN numbers functionally determine employee names
- SIN → EName
Project numbers functionally determines project names and locations
- PNum → PName, PLoc
Project locations and the number of hours functionally determine allowances
- PLoc, Hours → Allowance
What functional dependencies should hold as a consequence of the primary key of EmpProj?
SIN, PNum → SIN, PNum, Hours, EName, PName, PLoc, Allowance
Logical Consequence
Algorithm
Assume
function ComputeX+(X, F)
begin
X+ := X;
while true do
if there exists (Y -> Z) ∈ F such that
1. Y ⊆ X+
2. Z ⊈ X+
then X+ := X+ ∪ Z
else exit;
return X+;
end
Correctness Theorem:
Armstrong’s Axioms
Keys
Superkey theorem for functional dependencies: