从函数依赖性检查第三范式
我有一个关于根据函数依赖关系确定关系是否处于第三范式的问题。
R = {A,B,C,D,E}
<代码>A - > B
<代码>BC - > E <代码>ED - > A
由此,我确定候选键为: {ACD},{BCD},{CDE}
维基百科表示,如果对于每个函数依赖 X->Y,关系至少满足以下要求之一,则该关系处于第三范式: 1. Y是X的子集 2. X 是超级键 Y 是某个键 K 的 K 子集
我的工作:A ->由于键
满足 3,由于 {BCD}
,B{CDE}
,BC->E
满足 3,并且CD->由于
满足3。{ACD}
,A
这是解释这些规则的正确方式吗?
I have a question about determining whether a relation is in 3rd Normal Form based on functional dependencies.
R = {A,B,C,D,E}
A -> B
BC -> E
ED -> A
From this, I determined the candidate keys to be:{ACD},{BCD},{CDE}
Wikipedia says that a relation is in 3rd Normal Form if, for each functional dependency X->Y, it meets at least one of the following requirements:
1. Y is a subset of X
2. X is a superkey
Y is a subset of K for some key K
My work: A -> B
satisfies 3 because of the key {BCD}
, BC->E
satisfies 3 because of {CDE}
, and CD -> A
satisfies 3 because of {ACD}
.
Is this the correct way of interpreting those rules?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
<代码>A - > B 表示函数依赖。但是这些
R1 = {A,B}
R2 = {B,C,E}
R3 = {E,D,A}
表示关系。 (我假设您的意思是我们将这些视为您分解 R 得到的关系。)
范式适用于关系;它们不适用于函数依赖。说“
A -> B
is in 3NF”或“A 决定 B is in 3NF”是没有任何意义的。所以 R1 = {A,B} 是一个关系。它不“由于密钥 {B,C,D} 而满足规则 3”。不能,因为 {B,C,D} 不在 R1 中。
这些规则与分解 R 所产生的关系的候选键有关,而不是与 R 本身的候选键有关。
稍后。 。 .我发现我做出了错误的假设。您正在尝试评估 R,而不是分解它。在这种情况下,你的推理是正确的,R 属于 3NF。您还可以得出结论,R 属于 3NF,因为不存在非素数属性。由于不存在非素数属性,因此每个 FD 的右侧必须是候选键的一部分。
但R不在BCNF中。 (或者 4NF,或者 5NF。)你能解决这个问题吗?
A -> B
expresses a functional dependency. But theseR1 = {A,B}
R2 = {B,C,E}
R3 = {E,D,A}
express relations. (I'm assuming you meant us to take these as the relations you got from decomposing R.)
Normal forms apply to relations; they don't apply to functional dependencies. It doesn't make any sense to say "
A -> B
is in 3NF", or "A determines B is in 3NF".So R1 = {A,B} is a relation. It doesn't "satisfy rule 3 because of the key {B,C,D}". It can't, because {B,C,D} isn't in R1.
Those rules have to do with the candidate keys of the relations that result from decomposing R, not with the candidate keys of R itself.
Later . . . I see I made an incorrect assumption. You're trying to evaluate R, not decompose it. In that case your reasoning is correct, and R is in 3NF. You could also conclude that R is in 3NF because there are no non-prime attributes. Since there are no non-prime attributes, the right-hand side of every FD must be part of a candidate key.
But R is not in BCNF. (Or 4NF, or 5NF.) Can you fix that?