当函数依赖是循环时会发生什么?
我试图将以下关系分解为 3NF:
A -> BCD
BC -> DE
C -> D
D -> A
所以我消除了冗余以获得规范覆盖:
A -> BC
B -> E
C -> D
D -> A
现在我试图将其分解为 3NF。
我应该分解为 r1(A, B, C) r2(B, D), r3(C, D) 吗?那我该怎么办 D ->一个?
事实上A -> B-> D-> A 让我失望了。
I am trying to decompose the following relationships in to 3NF:
A -> BCD
BC -> DE
C -> D
D -> A
So I eliminated the redundancy to get the canonical cover:
A -> BC
B -> E
C -> D
D -> A
And now I am trying to decompose this into 3NF.
Should I decompose into r1(A, B, C) r2(B, D), r3(C, D)
. Then what do I do with D -> A
?
The fact that A -> B -> D -> A
is throwing me off.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
为了
获得规范覆盖,我们首先从 BC->DE 中删除 D:
接下来,我们观察到 C->D,D->A,A->BC,如果我们知道 B->E,则我们也知道 C->E。因此,
3NF 分解的工作原理如下:
1) 为规范覆盖中的每个依赖项创建表
2) 确定 R 的候选键。如果步骤 1 的表中不包含候选键,则添加一个仅包含候选属性的新表钥匙。
这里 A 是候选键,它包含在 R1(和 R4)中,因此不应添加新表。
3) 如果存在一个表,其属性是另一个表的属性的子集,则删除“包含”表。
这不适用,因此 3NF 分解保持不变。
如您所见,循环依赖关系没有问题。
Given
to obtain a canonical cover we first remove D from BC->DE:
Next, we observe that C->D, D->A, A->BC and if we know B->E, then we also know C->E. Hence,
3NF decomposition works as follows:
1) Create tables for each dependency in the canonical cover
2) Determine candidate keys of R. If no candidate keys are contained in the tables of step 1, add a new table containing only attributes of a candidate key.
Here A is a candidate key and it is contained in R1 (and R4), so no new tables should be added.
3) If there is a table such that its attributes are a subset of attributes of another table, remove the "contained" table.
This is not applicable, so the 3NF decomposition remains unchanged.
As you see, circular dependencies are not problematic.