简体   繁体   English

对超级键或Boyce Codd Normal形式的误解是什么

[英]Misconception of what superkey or Boyce Codd Normal form is

At 9:34 in this video the speaker says that all 3 functional dependencies are in Boyce Codd Normal Form. 这段视频的9点34分,发言者说所有3个功能依赖都是Boyce Codd Normal Form。 I don't believe it because clearly GPA can't determine the SSN, sName, address and all other attributes in the student table. 我不相信,因为显然GPA无法确定学生表中的SSN,sName,地址和所有其他属性。 Either I'm confused about the definition of Boyce Codd Normal Form or what a super key is? 我对Boyce Codd Normal Form的定义或超级密钥的含义感到困惑吗? Does it only have to be able to uniquly identify certain attributes, not all attributes in the schema? 它是否必须能够唯一地识别某些属性,而不是模式中的所有属性? For example GPA does determine priority (which is on the right side of the functional dependency) but not everything else. 例如,GPA确定优先级(位于功能依赖性的右侧),但不确定其他所有优先级。

For example if I had the relation R(A,B,C,D) and the FDs A->B would we say A is a superkey for B but I thought a super key is for the whole table? 例如,如果我有关系R(A,B,C,D)和FDs A-> B,我们会说A是B的超级密钥,但我认为超级密钥是针对整个表格的吗? To add to my confusion I know for BCNF it can be a (primary) key but you can only have on primary key for the table. 为了增加我的困惑,我知道BCNF它可以是(主)键,但你只能拥有该表的主键。 Ugh my brain hurts. 我的大脑很痛。

"... the speaker says that all 3 functional dependencies are in Boyce Codd Normal Form." “......发言者说,所有3个功能依赖都是博伊斯科德范式。”

To be in BC normal form is a property that can be had by RELATIONS (relation variables , more specifically, or relation schemas , if that term suits you better), not by functional dependencies. 要处于BC正常形式是一个属性,可以由RELATIONS (关系变量 ,更具体地说,或关系模式 ,如果该术语更适合你),而不是功能依赖。 If you find someone talking so sloppily of normalization theory, leave and move onto more accurate explanations. 如果你发现某人谈论如此笨拙的规范化理论,请离开并转向更准确的解释。

Whether or not a relation variable is indeed in BC normal form, depends on which functional dependencies are supposed to hold in it. 关系变量是否确实处于BC正规形式,取决于应该在其中保留哪些功能依赖性。 That is why it is utter nonsense to say that functional dependencies are or are not in BC normal form. 这就是为什么说功能性依赖性是否属于BC正常形式完全是胡说八道。

"I don't believe it because clearly GPA can't determine the SSN, sName, address and all other attributes in the student table. Either I'm confused about the definition of Boyce Codd Normal Form or what a super key is? Does it only have to be able to uniquly identify certain attributes, not all attributes in the schema?" “我不相信,因为很明显GPA无法确定学生表中的SSN,sName,地址和所有其他属性。要么我对Boyce Codd Normal Form的定义或者超级密钥是什么感到困惑?它只需要能够唯一地识别某些属性,而不是模式中的所有属性?“

An irreducible candidate key is that set (not necessarily unique) of attributes of the relation schema that is guaranteed to have unique combinations of attribute values in whatever relation values could validly appear in the relation variable in the database. 不可缩减的候选键是关系模式的属性集(不一定是唯一的),其保证具有属性值的唯一组合,无论任何关系值可以有效地出现在数据库中的关系变量中。

In your (A,B,C,D) example, if A->B is the only FD that holds, then the only candidate key is {A,C,D}. 在您的(A,B,C,D)示例中,如果A-> B是唯一保留的FD,则唯一的候选键是{A,C,D}。

"For example if I had the relation R(A,B,C,D) and the FDs A->B would we say A is a superkey for B" “例如,如果我有关系R(A,B,C,D)和FDs A-> B,我们会说A是B的超级密钥”

It is sloppy and confusing to talk of A as being the "key" for B in such a case. 在这种情况下,谈论A作为B的“关键”是邋and和混乱的。 People who pretend to be teaching others ought to know this, and people who don't, ought not engage in any teaching until they do know this. 假装教别人的人应该知道这一点,而那些不这样做的人,除非他们知道这一点,否则不应该从事任何教学。 It would be better to talk of A as the "determinant" for B in such contexts. 在这种情况下,最好将A作为B的“决定因素”。 The term "key" in the context of relational database design has a very well-defined and precise meaning, and using the same term for other meanings merely confuses people. 在关系数据库设计的上下文中,术语“关键”具有非常明确和精确的含义,并且对于其他含义使用相同的术语仅仅使人混淆。 As evidenced by your question. 正如你的问题所证明的那样。

"but I thought a super key is for the whole table?" “但我觉得超级钥匙适用于整张桌子?”

Yes you thought right. 是的,你认为是对

Back to your (A,B,C,D) example. 回到你的(A,B,C,D)例子。 If we were to split that design into (A,B) and (A,C,D), then we would have a relation schema -the (A,B) one- of which we can say that "{A} is a key" in that schema. 如果我们将该设计分为(A,B)和(A,C,D), 那么我们将得到一个关系模式 - (A,B)其中一个我们可以说“{A}是一个密钥“在该模式中。

That is actually precisely what the FD A->B means : if you take the projection -of the relation value that would appear in the database in the (A,B,C,D) schema- over the attributes {A,B}, then you should be getting a relation in which no A value appears twice (if it did, then that A value would correspond to >1 distinct B value, meaning that A could not possibly be a determinant for B after all). 这实际上正是FD A-> B的含义: 如果你在(A,B,C,D)模式中对属性{A,B}中的关系值进行投影 - , 那么你应该得到一个没有A值出现两次的关系(如果确实如此,那么A值将对应于> 1个不同的B值,这意味着A毕竟不可能是B的决定因素)。

"To add to my confusion I know for BCNF it can be a (primary) key but ..." “为了增加我的困惑,我知道BCNF它可以是一个(主要)键但......”

Now you are being sloppy yourself. 现在你自己很邋.. What does "it" refer to ? “它”指的是什么?

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

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