将关系分解为第四范式

Decomposing relations to Fourth Normal Form

披露:我正在服用 Stanford's online database course。那里的论坛已经死了,我希望能得到一些帮助。

这是测验问题:

Consider relation R(A,B,C,D,E) with multivalued dependencies:

A -» B, B -» D

and no functional dependencies. Suppose we decompose R into 4th Normal Form. Depending on the order in which we deal with 4NF violations, we can get different final decompositions. Which one of the following relation schemas could be in the final 4NF decomposition?

这是我的想法:

由于我们没有函数依赖性,唯一的键是属性集 (A,B,C,D,E)。也就是说,题中的两个多值依赖都违反了,必须分解。

我正在遵循讲座中给出的分解算法:

Compute keys for R [done]

Repeat until all relations are in 4NF

Pick any R' with nontrivial A -» B that violates 4NF
Decompose R' into R_1(A, B) and R_2(A, rest)
Compute functional dependencies and multivalued dependencies for R_1 and R_2
Compute keys for R_1 and R_2

我看到两种分解关系的方法:从 A -» BB -» D 开始。

从 A 开始 -» B

R(A,B,C,D,E)
      |
      +-----------+
      |           |
 R_1(A,B)  R_2(A,C,D,E)

因为 BD 不再处于同一个关系中,我们没有违反 4NF,我们就完成了。我现在不确定如何计算 FD、MVD 和密钥。

以 B 开头 -» D

R(A,B,C,D,E)
      |
      +-----------+
      |           |
 R_1(B,D)  R_2(B,A,C,E)
                  |
                  +----------+
                  |          |
             R_3(A,B)  R_4(A,C,E)

至此,(A and B) 和(B and D) 被分解成了各自的关系,所以我们没有违规,并且我们完成了。

答案选择:

在这一点上,我完全被难住了。我在答案选择中看不到任何关系,也想不出一个能让我到达那里的想法:

  1. CE
  2. AD
  3. AE
  4. ABD

我不需要直接的答案,但我错过了什么?

正确答案是 AD

这个是怎么得到的?

考虑一下,就像函数依赖一样,您可以拥有由其他多值依赖隐含的多值依赖。例如,有一个伪传递规则(或多值传递规则)说:

If X →→ Y holds, and Y →→ Z holds, then X →→ Z − Y holds

对于此规则,您可以从 A →→ BB →→ D 推导出 A →→ D。所以,如果你分解 4NF 中的关系,你可以从这个依赖关系开始,并得到一个 table 和属性 AD。或者,或者,在你的第一次分解中,在找到 R_1(A,B)R_2(A,C,D,E) 之后,你应该继续分解 R_2,因为它仍然包含非平凡的 MVD A →→ D,到找到 R_3(A, D)R_3(A, C, E).