Multivalue Dependency violation?

a 夏天 提交于 2019-12-13 01:29:08

问题


i am confused about mvd violation, simply i cant figure out anything that will violate mvd, for example there are A B C three columns, each row is a tuple

A B C

a2 b2 c1
a1 b1 c2
a1 b1 c3
a2 b3 c1

does B->>C and B->>A?

thanks


回答1:


An MVD, just like an FD, is a rule. It applies to your business case or not, you'll need to inspect the requirements and/or the specs in order to know.

You cannot know whether it applies from looking at sample data (that applies to FD's as well).

Looking at sample data can only tell you, "if the rule applies, then this data will be valid/invalid", or "if this data must be valid, then some particular MVD rule certainly won't apply".

Now what does such an MVD rule state exactly ?

First take a look at what an FD states exactly. An FD states that for a certain [set of] attribute[s] (the Left side of the FD), it cannot be the case that some particular [combination of] value[s] is associated with more than one [combination of] distinct value[s] of the attributes on the Right hand side of the FD.

A->B indeed means that for all attribute value pairs (a1,b1) and (a2,b2), it holds that a1=a2 ===> b1=b2.

An MVD is a generalization of an FD, in that it does not state that individual B values must be associated with/determined by A values, but instead it states that SETS of B values must be associated with/determined by A values.

(warning : switching from A/B to B/C here !)

In your example, b2 is "associated" with the set {c1}, and the value b1 is "associated" with the set {c2,c3}. Now if the MVD B->>C applies indeed, then it should be impossible for a row a4,b1,c2 to appear in your table unless the row a4,b1,c3 also appears, simultaneously. Likewise, if you have those two additional rows, and you add a1,b1,c4, this will "add" c4 to the set of values that are "multidetermined by" the value b1, and consequently, your MVD will be violated unless you also add a4,b1,c4.




回答2:


It would violate MVD if you were to change the value of a1 to something else on one of the rows for b1.

A B C

a2 b2 c1
a1 b1 c2
a3 b1 c3
a2 b3 c1

If B ->> A and B->>C, it should be true that for a given value of B, the rows should be formed by a cross-product of the distinct values of A and C. In other words, every permutation of different values of A and C would be represented.

If you needed b1 to determine a1/a3 and c2/c3, then your table should look like this:

A B C

a2 b2 c1
a1 b1 c2
a1 b1 c3
a3 b1 c2
a3 b1 c3
a2 b3 c1

But I don't think there's enough information in your example to say that B->>A and B->>C. It's also possible that A->>B and A->>C, or that C->>A and C->>B.




回答3:


is this about mvd violation or 4NF violation? Did you check http://en.wikipedia.org/wiki/Multivalued_dependency?



来源:https://stackoverflow.com/questions/7963832/multivalue-dependency-violation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!