What did I do wrong? (Find FD from table)

2020-08-09 04:46发布

问题:

Here is the table Income:

Here is my answer:

costumer -> city

costumer -> population

price -> product

price -> costumer

price -> city

price -> population

city -> population

population -> city

but actually the answer is:

(product, costumer) -> price

costumer -> city

city -> population

costumer -> population

What did I do wrong? I have been use by his method: https://www.youtube.com/watch?v=ddOP5D4fagg

回答1:

We say that a FD (functional dependency) expression S -> T has a "determinant" set of attributes S and a "determined" set of attributes T. It says that a given subtuple value for S appears in a given relation value or variable/schema always with the same subtuple value for T. For S -> {A} we can say S -> A. For {A} -> T we can say A -> T.

Given a relation, we say that a FD "holds in" it or "is satisfied by" it or "is true" in it or (sloppily) "is in" it or (sloppily) it "has" a FD when what the FD says is true about it. Every FD that can be expressed using attributes of a relation value/variable/schema will either hold or not hold.

We can find all the FDs S -> T that hold in a relation by checking every subset of the set of attributes as S with every subset of attributes as T. There are also algorithms. FDs where S is a superset of T must hold and are called "trivial".

We can find all the FDs S -> A that hold in a relation by checking every subset of the set of attributes as S with every attribute as T. There are also algorithms. (Then to find all FDs that hold: FDs S -> {} hold trivially & whether S -> T for T with multiple elements can be found from the FDs S -> A.)

Here are some shortcuts: A set determines itself. If S -> T then every superset of S determines every subset of T. If S doesn't determine T then no subset of S determines any superset of T. If a set has a different subrow of values in every tuple (so it is "unique") then it determines every set. {} -> T when/iff every tuple has the same T subrow value.

Given some FDs that hold, Armstrong's axioms generate all FDs that must also hold. The latter is called the "closure" of the former. A set of FDs that generates a certain closure is called a "cover". A cover is "minimal" or "irreducible" when removing any FD from it gives a set that is not a cover. A minimal/irreducible cover with every determinant unique is "canonical".

Usually we are not asked to give a closure for all FDs that hold in a schema, we are asked to give a canonical cover for them. In general if we only know some FDs that hold in a schema then we don't know that its closure is all the FDs that hold.


You only listed FDs that hold that have one determinant and one determined attribute; you didn't list any of the FDs that hold that have larger determinants. But if you want to produce the right answer then you need to tell us what the question was exactly. (And please confirm what the right answer was exactly.)