If B is functionally dependent on A (A -> B) can A be functionally dependent on B (B -> A)? Why?
Example:
A table contains five columns: Patient Number, Full name, Bed number, Ward number and Ward name.
Is it possible to say that Ward Number -> Ward Name and Ward Name -> Ward Number?
From my understanding a functional dependency A -> B means that given a tuple containing A there will always be the same B, but not the other way around.
A Ward will always have the same number and name making the functional dependency go both ways.
If B is functionally dependent on A (A -> B) can A be functionally dependent on B (B -> A)?
Yes. Informally, it might help you to think about it this way.
Say a relation has two candidate keys, A and B. Since A is a candidate key, it determines all the other attributes. So A->B. And since B is a candidate key, it also determines all the other attributes. So B -> A.
For a real-world example, think about a table of chemical elements. (WARNING: I'm not a chemist.)
element_name atomic_number chem_symbol -- Hydrogen 1 H Helium 2 He Lithium 3 Li ...
Each of these three columns is a candidate key. And element_name
determines atomic_number
and chem_symbol
, atomic_number
determines element_name
, and chem_symbol
, etc.