几个标准化问题
我的问题是:
1)如果我有关系R(A,B,C)
,作为AB
主键,并且F = {},我可以假设
C
依赖于 AB
吗?我会说不,但我问只是为了确定一下。
2) 我理所当然地认为 AB -> CDE
与 AB -> 相同。 C
,AB -> D
,AB -> E
以及 AB -> CE
,AB -> D。我说得对吗?
3) 取R(A,B,C,D)
,作为AB
主键,F = {AB->C}
。这是2NF
吗?我想说不,因为 D
不依赖于任何其他属性,更不用说主键了!
4) 我试图了解
R(K, L, M, N, O,P)
主键
F = { KL->MN, KL->OP, M->N, O->P }
R
是 KL
是在 2NF
还是 3NF
中。 P
和 N
都依赖于(尽管是间接的)整个主键。加入 2NF
就足够了吗?如果是,我会说 R
不在 3NF
中,因为 3NF
关系上的非素数属性之间不应该存在依赖关系, 正确的?
谢谢
My questions are:
1) If I have the relation R(A,B,C)
, being AB
the primary key, and F = {}
, may I assume C
depends on AB
? I'd say no, but I'm asking just to make sure.
2) I'm taking for granted that AB -> CDE
is the same as saying AB -> C
, AB -> D
, AB -> E
and as of saying AB -> CE
, AB -> D
. Am I right?
3) Take R(A,B,C,D)
, being AB
the primary key with F = {AB->C}
. Is this in 2NF
? I'd say no, as D
doesn't depend on any other attribute, let alone the primary key!
4) I'm trying to understand if with
R(K, L, M, N, O,P)
being KL
the primary key
F = { KL->MN, KL->OP, M->N, O->P }
R
is in 2NF
or 3NF
. Both P
and N
depend (although indirectly) on the whole primary key. Is it enough to be in the 2NF
? If it is, I'd say R
is not in 3NF
as there shouldn't be dependencies between non-prime attributes on a 3NF
relation, right?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设这是家庭作业,所以我给出方向,不一定是答案。
当你没有得到任何函数依赖时,你知道如何识别函数依赖吗?在这种情况下,您会问自己以下问题:“给定 {A,B} 的值,这些值是否只能识别 {C} 的一个值?”如果答案是“是”,则说明存在函数依赖性;如果答案是“否”,那么你就不需要。
我不会说这“和说的一样”。我想说,从函数依赖 AB->CDE 中,您可以派生出所有其他函数依赖。
请参阅第 1 条。
扩展下面评论中的问题。 。 。
因为并非每个 1NF 表都具有多列主键,并且并非每个具有多列主键的 1NF 表都具有仅由该键的一部分确定的其他列。
哦,但是这两列之间存在某种关系。它们之间存在关系,因为您将它们放在同一个表中。在该表中,如果您知道 A 的值,那么您就知道 B 的一个且仅有一个值。(如果 A 确定了 B 的多个值,则 A 不可能是主键。)
I'm assuming this is homework, so I'm giving direction, not necessarily answers.
Do you know how to identify a functional dependency when you're not given any? In this case, you ask yourself this question: "Given values for {A,B}, do those values identify one and only one value for {C}?" If the answer is "yes", you have a functional dependency; if the answer is "no", then you don't.
I wouldn't say it's "the same as saying". I'd say that from the functional dependency AB->CDE, you can derive all those other functional dependencies.
See number 1.
Expanding on questions in the comments below . . .
Because not every 1NF table has a multi-column primary key, and not every 1NF table that does have a multi-column primary key has other columns determined by only part of that key.
Oh, but there is a relationship between those two columns. There's a relationship between them, because you put them in the same table. Within that table, if you know the value for A, then you know one and only one value for B. (If A determined more than one value for B, then A couldn't possibly be the primary key.)