查找关系中具有最多数量的候选键? [英] finding largest number of candidate keys that a relation has?

查看:161
本文介绍了查找关系中具有最多数量的候选键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解决这个与关系中的候选键有关的问题. 这是问题:

I am trying to solve this question which has to do with candidate keys in a relation. This is the question:

    Consider table R with attributes A, B, C, D, and E. What is the largest number of
candidate keys that R could simultaneously have?

答案是10,但我不知道它是如何完成的,也不知道单词在计算答案时如何同时起作用.

the answer is 10 but i have no clue how it was done, nor how does the word simultaneously plays into effect when calculating the answer.

推荐答案

不是其他集合子集的集合.
例如,{A-B}和{A,B,C}不能同时作为候选键,因为{A,B}是{A,B,C}的子集.
2个属性或3个属性的组合会生成最大数量的同时候选键.
查看这3个属性集实际上是2个属性集的补充,例如{C,D,E}是{A,B}的补码.

Sets that are not subsets of other sets.
For example {A-B} and {A,B,C} can't be candidates keys simultaneously, because {A,B} is a subset of {A,B,C}.
Combinations of 2 attributes or 3 attributes generates the maximum number of simultaneous candidates keys.
See how the 3 attributes sets are actually complements of the 2 attributes sets, e.g. {C,D,E} is the complement of {A,B}.

         2               3    
     attributes      attributes
       sets            sets

   1.  {A,B}    -     {C,D,E}
   2.  {A,C}    -     {B,D,E}
   3.  {A,D}    -     {B,C,E}
   4.  {A,E}    -     {B,C,D}
                -     
   5.  {B,C}    -     {A,D,E}
   6.  {B,D}    -     {A,C,E}
   7.  {B,E}    -     {A,C,D}
                -     
   8.  {C,D}    -     {A,B,E}
   9.  {C,E}    -     {A,B,D}
                -     
   10. {D,E}    -     {A,B,C}


如果我要设置一个属性集,那么我将只有4个选项


If I would take sets of a single attribute I would have only 4 options

{A},{B},{C},{D}

任何包含1个以上元素的集合都将包含上述之一,因此将不合格.

Any set with more than 1 element will contain one of the above and therefore will not be qualified.

如果我要设置4个属性集,那么我将只有4个选项

If I would take sets of 4 attributes I would have only 4 options

{A,B,C,D},{A,B,C,E},{A,B,D,E},{B,C,D,E}

任何包含4个以上元素的集合都将包含上述之一,因此将不合格. 少于4个元素的任何集合将包含在上述元素之一中,因此将不合格.

Any set with more than 4 element will contain one of the above and therefore will not be qualified. Any set with less than 4 element will be contained by one of the above and therefore will not be qualified.

这篇关于查找关系中具有最多数量的候选键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆