违反多值依赖关系?

发布于 2024-12-13 10:12:00 字数 189 浏览 3 评论 0原文

我对 mvd 违规感到困惑,只是我无法弄清楚任何会违反 mvd 的内容,例如有 ABC 三列,每行都是一个元组

A BC

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

B->>C 和 B->>A 吗?

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

海螺姑娘 2024-12-20 10:12:00

MVD 就像 FD 一样,是一个规则。它是否适用于您的业务案例,您需要检查要求和/或规格才能知道。

您无法通过查看样本数据来知道它是否适用(这也适用于 FD)。

查看样本数据只能告诉您,“如果规则适用,那么该数据将有效/无效”,或者“如果该数据必须有效,那么某些特定的 MVD 规则肯定不会适用”。

那么,这样的 MVD 规则具体说明了什么?

首先看看 FD 的具体内容。。 FD 规定,对于某个[一组]属性(FD 的左侧),某些特定[组合]值不可能与多个[组合]相关联。 FD 右侧属性的不同值。

A->B确实意味着对于所有属性值对(a1,b1)和(a2,b2),它认为a1=a2 ===> b1=b2。

MVD 是 FD 的概括,因为它没有声明各个 B 值必须与 A 值关联/由 A 值确定,而是声明SETS B 值必须与 A 值关联/由 A 值确定。

(警告:此处从 A/B 切换到 B/C!)

在您的示例中,b2 与集合 {c1} “关联”,值 b1 与集合 {c2,c3} “关联”。现在,如果 MVD B->>C 确实适用,那么行 a4,b1,c2 应该不可能出现在表中,除非行 a4,b1,c3 也同时出现。同样,如果您有另外两行,并且添加了 a1,b1,c4,这会将 c4 “添加”到由值 b1 “多重确定”的值集中,因此,您的 MVD 将被违反,除非您还添加a4、b1、c4。

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.

神也荒唐 2024-12-20 10:12:00

如果您要将 b1 的其中一行上的 a1 值更改为其他值,则会违反 MVD。

ABC

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

如果 B ->> A 和 B->>C,对于给定的 B 值,行应该由 A 和 C 的不同值的叉积形成。换句话说,A 和 C 的不同值的每个排列都将被表示。

如果您需要 b1 来确定 a1/a3 和 c2/c3,那么您的表格应如下所示:

ABC

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

但我认为您的示例中没有足够的信息来说明 B->>A 和 B->>C。也可能是A→B和A→C,或者C→A和C→B。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文