几个标准化问题

发布于 2024-11-24 19:16:46 字数 934 浏览 1 评论 0原文

我的问题是:


1)如果我有关系R(A,B,C),作为AB主键,并且F = {},我可以假设 C 依赖于 AB 吗?我会说不,但我问只是为了确定一下。


2) 我理所当然地认为 AB -> CDEAB -> 相同。 CAB -> DAB -> E 以及 AB -> CEAB -> 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 }

RKL 是在 2NF 还是 3NF 中。 PN 都依赖于(尽管是间接的)整个主键。加入 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

半城柳色半声笛 2024-12-01 19:16:46

我假设这是家庭作业,所以我给出方向,不一定是答案。

1) 如果我有关系 R(A,B,C),AB 为主键,F =
{},我可以假设 C 依赖于 AB 吗?我会说不,但我只是想问
确保。

当你没有得到任何函数依赖时,你知道如何识别函数依赖吗?在这种情况下,您会问自己以下问题:“给定 {A,B} 的值,这些值是否只能识别 {C} 的一个值?”如果答案是“是”,则说明存在函数依赖性;如果答案是“否”,那么你就不需要。

2) 我理所当然地认为 AB -> CDE 与 AB -> 相同。
C、AB-> D、AB-> E 和AB 一样-> CE、AB-> D、我说得对吗?

我不会说这“和说的一样”。我想说,从函数依赖 AB->CDE 中,您可以派生出所有其他函数依赖。

3) 取R(A,B,C,D),AB为主键,F = {AB->C}。这是
在2NF?我会说不,因为 D 不依赖于任何其他属性,让
单独的主键!

请参阅第 1 条。


扩展下面评论中的问题。 。 。

如果你说,{A,B} -> {每隔一列},那为什么不都是 1NF
2NF 中的关系?

因为并非每个 1NF 表都具有多列主键,并且并非每个具有多列主键的 1NF 表都具有仅由该键的一部分确定的其他列。

将 PK 想象为一个人的 ID。现在想象一下唯一的另一个
该关系中的属性是发现飞来的鸭子数量
97 年的亚利桑那州。 A和B之间不存在任何关系
在现实世界中,但从你所说的来看,人们会假设 A -> B.

哦,但是这两列之间存在某种关系。它们之间存在关系,因为将它们放在同一个表中。在该表中,如果您知道 A 的值,那么您就知道 B 的一个且仅有一个值。(如果 A 确定了 B 的多个值,则 A 不可能是主键。)

I'm assuming this is homework, so I'm giving direction, not necessarily answers.

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.

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.

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?

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.

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!

See number 1.


Expanding on questions in the comments below . . .

If you say, {A,B} -> {every other column}, then why aren't all 1NF
relations in 2NF?

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.

Imagine a PK being the ID of a person. Now imagine the only other
attribute in that relation being the number of ducks found flying in
Arizona in '97. There isn't any kind of relationship between A and B
in the real world, yet from what you say, one'd assume A -> B.

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.)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文