简体   繁体   English

Boyce-Codd 范式中的关系能否在主要属性之间具有函数依赖关系?

[英]Can a relation in Boyce-Codd Normal Form have functional dependencies between prime attributes?

My question is pretty simple.我的问题很简单。 From what I've seen, it seems normalization from 1NF, 2NF, 3NF up to Boyce-Codd form seem to deal mostly the matter of non-prime attributes.从我所见,似乎从 1NF、2NF、3NF 到 Boyce-Codd 形式的规范化似乎主要处理非主要属性的问题。 If I am not mistaken, then, the following table is in Boyce-Codd form:如果我没记错的话,下表是 Boyce-Codd 形式:

R(A,B,C), F = {AB->C, A->B}

with A,B being a compound primary key, which would seem odd to me. A,B 是复合主键,这对我来说似乎很奇怪。

Am I missing something here?我在这里错过了什么吗?

If A->B then {AB} can't possibly be a primary key because it isn't minimal.如果 A->B 则 {AB} 不可能是主键,因为它不是最小的。 Assuming therefore that A is the only key then R is in at least BCNF with respect to the dependencies AB->C, A->B.因此假设A是唯一的键,那么 R 就依赖关系 AB->C、A->B 而言至少处于 BCNF 中。

If A determines B (A -> B) then saying that AB determines C (AB -> C) implies that A determines C (A -> C).如果 A 确定 B (A -> B),那么说 AB 确定 C (AB -> C) 意味着 A 确定 C (A -> C)。

Saying A -> B means that there are no two records where the B columns have different values but the A columns have the same value.说 A -> B 意味着没有两条记录,其中 B 列具有不同的值但 A 列具有相同的值。

Saying AB -> C means that there are no two records where the C columns have different values but both the A and B columns have the same value.说 AB -> C 意味着没有两条记录,其中 C 列具有不同的值,但 A 和 B 列具有相同的值。 Although, because A -> B, we already know that if the A columns have the same value then the B columns also have the same value.虽然,因为 A -> B,我们已经知道如果 A 列具有相同的值,那么 B 列也具有相同的值。 Thus, we can say that, seeing that A -> B then AB -> C implies A -> C.因此,我们可以这样说,看到 A -> B 然后 AB -> C 意味着 A -> C。

Thus, the FDs in R are:因此,R 中的 FD 为:

  1. A -> B A -> B
  2. A -> C A -> C

For a relation to be in BCNF the following must hold:对于在 BCNF 中的关系,必须满足以下条件:

  1. It must already be in 3NF它必须已经在 3NF 中
  2. There mustn't be non-trivial functional dependencies where the determinant is not a super key在行列式不是超级键的情况下,不能有非平凡的函数依赖

As you already have a relation in 3NF, as you stated, we satisfy the 1st condition.正如您所说,由于您已经在 3NF 中建立了关系,因此我们满足第一个条件。 As in all of R's FDs the determinant is a super key (A is a super key), we satisfy the 2nd condition.在所有 R 的 FD 中,行列式都是超级键(A 是超级键),我们满足第二个条件。

Thus, R is in BCNF.因此,R 在 BCNF 中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM