[Database Principles] Relational Database Theory (3)

Full/partial functional dependency.

Insert picture description here

Obviously, it makes sense to discuss full/partial functional dependency only when the determinant is a combination of attributes, because when the determinant is a single attribute, it will only be a complete functional dependency.

Transfer function dependency.

Insert picture description here
It should be noted that the transfer function dependency can be a complete functional dependency or a partial functional dependency.

★Attribute set closure algorithm.

As mentioned earlier, for the functional dependency set F and its closure F + F^+ on the relational pattern R(U)FThe concept of + , in actual work people want to know that a certain function depends onX → YX → YXWhether Y is true, ifF + F^+F+ Known, then just look atF + F^+F+ Whether to include the function dependency. But the problem is thatF + F^+F+It is difficult to calculate and contains a lot of redundant information, which can be said to be high investment and low return. In order to determine whether X→Y holds as quickly as possible, people think of computing the closureX + X^+ of theattribute set XX+ Instead ofF + F^+F+ . In other words, as long as you find all the attribute sets determined by X, you can determine whether X→Y holds.
Insert picture description here
Insert picture description here
It can be seen that the algorithm of attribute set closure has the following uses:

  • Determine whether the attribute set X is the code of the relational pattern R by calculating the attribute set closure of X + X^+X+ , And then judgeX + X^+X+ Whether all the attributes in R are included in + , if yes, then X is the code of relational mode R; otherwise, X is not.
  • By checking whether Y is X + X^+X+ To verify whether the function depends on X→Y.

Insert picture description here

Candidate code.

Insert picture description here
According to the above definition, although the super code can determine all the attributes, there are many useless attributes in it, and the candidate code has [minimality]. What we are interested in is how to solve the candidate code X of a relational pattern R.

★Candidate code algorithm.

Insert picture description here
In the theorem, the third one is more used, and the rest are not very helpful to the problem, especially the sixth one, which means nothing.

Insert picture description here
Insert picture description here

Equivalent function dependency set.

From a formal point of view, the scale of the function dependency set F is often given is small, and its corresponding F + F^+F+ But much more complicated. But we know thatFFF andF + F^+F+ The information expressed by the two is the same, so a question naturally comes to mind: Is there any other functional dependency set F'that is equivalent to F? If so, can we find the smallest one? In response to this problem, we first give the definition of the
Insert picture description here
equivalence of the functional dependency set:two equivalent functional dependency sets are completely the same in the information representation ability. And in fact, we check whether F is equivalent to G, without really calculating the closure of the two, a simple method is as follows:
Insert picture description here

Irrelevant functional dependencies.

There are many functional dependencies in some functional dependency sets. Our idealized situation is to remove those dependent functional dependencies, trivial functional dependencies (because it has no meaning), and irrelevant attributes in the functional dependencies, and finally obtain the function on the functional dependency set F The equivalent set with the least number of dependencies F min F_{min}Fm i n.
Insert picture description here

★Minimum functional dependency set F min F_{min}Fm i nalgorithm.

Insert picture description here
Insert picture description here
Correction: L3 in step F2: first judge X + X^+XWhether A is included in + , if it is, it means that Y is a redundant attribute and can be removed.
Insert picture description here
Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/weixin_44246009/article/details/108084889