2015-08-21 136 views
0

我遇到了这个问题。查找关系的主键

查找关系R的主键(A,B,C,d,E,F,G,H,I),其中:

A -> B,C 
E -> F 
D -> I 
A,D -> G 
G -> H 

由于

+1

看起来应该是A,D,E – Nickthename

回答

0

的(仅)键为A, D, E,其实,如果你计算关闭,您将获得:

1. (A,D,E)+ = A,D,E 
2. You add B,C for the first dependence, so now (A,D,E)+ = A,D,E,B,C 
3. You add F for the second dependence, so now (A,D,E)+ = A,D,E,B,C,F 
4. You add I for the third dependence, so now (A,D,E)+ = A,D,E,B,C,F,I 
5. You add G for the fourth dependence, so now (A,D,E)+ = A,D,E,B,C,F,I,G 
6. And finally you add H for the last dependence, so that (A,D,E)+ = A,D,E,B,C,F,I,G,H 

由于A,d,E确定是否所有的属性,这是一个关键。为了证明这是唯一的关键,注意A,D,E的属性不出现在函数依赖的右侧,所以它们都必须属于一个关键。而且由于它们形成了一个密钥,所以不能存在其他(候选)密钥。

+0

谢谢@Renzo,这非常有帮助。是否也可以安全地推断出这不是在3NF中,并且由于G→H而不在BCNF中? – newbie72

+0

对于所有*依赖关系,关系不在3NF中,不仅对于G-> H。同样,对于所有依赖关系,它不在BCNF中。 – Renzo

+0

现在对我来说很有意义。感谢您的帮助。我已经向前移动并按照步骤分解为3NF/BCNF并确定了以下内容:R1A(A,G,B,C)R1B(G,H)R2(D,I)R3(E,F)正确? – newbie72