奇怪的BCNF在我过去的考试中分解

时间:2014-05-18 17:17:57

标签: database-normalization bcnf

我在将此问题分解为BCNF时遇到了问题:

Relation: R[A E P M N S T L]

FD's:
A -> EM, 
A -> L, 
M -> ST,
M -> N,
S -> T, 
E -> P, 
P -> E, 
L -> A

这是我过去的一次考试,我真的不知道如何解决。

我在编写课程文献的女人(詹妮弗威德姆)的课程中学到了这一点:

-------------- BCNF ALGORITHM ------------
1. Take a FD that violates BCNF.
2. Decompose the FD to two other relations
3. First relation: The whole FD
4. Second relation: The rest of the Relation + the left hand side of the chosen FD 
5. Iterate until all the new relations have key on its left hand side
-------------- BCNF ALGORITHM ------------

And I also tried another one that is basically the same, but written in a different way:
X->Y: R1({X}+), R2(R - {X}+ ; X) (Relation minus {X}+ (XY in this case), plus X.

到目前为止,我在这里: 显然,A是关键,因此其FD已经在BCNF中。问题是,我可以删除任何冗余的FD吗?如果是这样,拇指规则是什么?

R1(MST) <-- BCNF.
R2(A E P M N L)
R3()

并且不知道该去哪里。

1 个答案:

答案 0 :(得分:0)

1. Take a FD that violates BCNF.
5. Iterate until all the new relations have key on its left hand side

提及BCNF违规的步骤1只有在意味着您应该识别每个原始和生成关系的密钥和非密钥隐含的FD时才有意义。此外,步骤5终止不能仅仅在左侧存在键时,因为可能存在非键确定器。显然,当所有关系都在BCNF时停止是必要和充分的。算法的特定完整描述可以描述等效的重组和/或测试,而无需明确提及BCNF。

如果A是关键,那么L也是如此,因为L-> A。

MSTNAELP keys A and L plus M->ST, S->T, E<->P

那些FD来自非钥匙。你选择了M-> ST。我们得到:

MST key M plus S->T
MNAELP keys A and L plus E<->P

两者都有决定者不是来自密钥,因此不在BCNF中。选择S-> T和E-> P。我们得到:

ST key S in BCNF
SM key M in BCNF
EP keys P and E in BCNF
EMNAL keys A and L in BCNF