考虑关系方案R = {E,F,G,H,I,J,K,L,M,M}和功能依赖集{{E,F}-> {G},{F}-> R上的{I,J},{E,H}-> {K,L},K-> {M},L-> {N}。R的关键是什么?
(A) {E,F}
(B) {E,F,H}
(C) {E,F,H,K,L}
(D) {E}答案: (B)
说明:所有属性都可以从{E,F,H}派生
要解决GATE论文中经常问到的这类问题,请尝试使用快捷方式来解决它,以便节省足够的时间。
拳法:
使用给定的选项尝试获得每个选项的关闭。解决方案是既包含R又包含最小的超级密钥(即候选密钥)的解决方案。
A) {EF}+ = {EFGIJ} ≠ R(The given relation)
B) {EFH}+ = {EFGHIJKLMN} = R (Correct since each member of the
given relation is determined)
C) {EFHKL}+ = {EFGHIJKLMN} = R (Not correct although each member
of the given relation can be determined
but it is not minimal, since by the definition
of Candidate key it should be minimal Super Key)
D) {E}+ = {E} ≠ R
第二种方法:
Since, {EFGHIJKLMN}+ = {EFGHIJKLMN}
{EFGHIJKLM}+ = {EFGHIJKLMN} ( Since L -> {N}, hence can replace N by L)
In a similar way K -> {M} hence replace M by K
{EFGHIJKL}+ = {EFGHIJKLMN}
Again {EFGHIJ}+ = {EFGHIJKLMN} (Since {E, H} -> {K, L}, hence replace KL by EH)
{EFGH}+ = {EFGHIJKLMN} (Since {F} -> {I, J} )
{EFH}+ = {EFGHIJKLMN} (Since {E, F} -> {G} )
该解释由Manish Rai提供。
在此处了解更多信息:
使用功能依赖关系查找属性关闭和候选键这个问题的测验