database 规范化依赖

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16152167/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 08:56:26  来源:igfitidea点击:

Normalization Dependencies

databasedatabase-normalizationfunctional-dependencies

提问by user214577

Im just trying to make sure that im thinking of it the right way

我只是想确保我以正确的方式思考它

1)full dependencies are when one or more primary keys determine another attribute

1)完全依赖是指一个或多个主键决定另一个属性

2)partial dependencies are when one of the primary keys determines another attribute or attributes

2)部分依赖是当一个主键决定另一个属性或多个属性时

3)transitive dependencies are when a nonkey attribute determines another attribute

3) 传递依赖是当一个非键属性决定另一个属性时

am i thinking of it right?

我想对了吗?

回答by Dhruv Ghulati

This answer is directly from my CS course and obtained from the Connolly and Begg text book.

这个答案直接来自我的 CS 课程,并从 Connolly 和 Begg 教科书中获得。

enter image description here

在此处输入图片说明

Full Functional Dependencies

全功能依赖

Identify the candidate keys(here, propertyNo, iDate and pAddress). This is because any combination of those 3 can allow you to find what the other attributes are for a given tuple (I can find the staffNo that did the inspection given those three things, I can find the carReg the staffNo used given those 3 things etc.). But note, you need all of those 3 to find the other attributes, not just a subset.Full dependencies always relate to non-candidate keys depending on candidate keys, either depending on all or depending on some.

确定候选键(此处为 propertyNo、iDate 和 pAddress)。这是因为这 3 个的任何组合都可以让您找到给定元组的其他属性(我可以找到在这三件事的情况下进行检查的员工号,我可以找到 carReg 的员工号,因为这三件事等等.) 但请注意,您需要所有这 3 个属性才能找到其他属性,而不仅仅是一个子集。完全依赖总是与取决于候选键的非候选键相关,要么依赖于全部要么依赖于一些。

Partial Dependencies

部分依赖

Given those three candidate keys, look within the candidate keys. Is there any subset(s) of the candidate key which is dependent on the other? Yes, it is pAddress. Given a propertyNo, you can figure out what the address of the property. Then look outside of the candidate keys. Is there any of these keys that depend on only parts of the candidate key, not all components? In this case there are not. So partial dependencies are always dependencies within the candidate keys or dependencies of non-candidate keys on only parts of the candidate keys rather than all components

给定这三个候选键,查看候选键。是否存在依赖于另一个的候选键的任何子集?是的,它是 pAddress。给定一个propertyNo,你可以算出该属性的地址是什么。然后查看候选键之外。是否有任何这些键仅依赖于候选键的一部分,而不是所有组件?在这种情况下没有。所以部分依赖总是候选键内的依赖或非候选键的依赖只依赖于候选键的一部分而不是所有组件

Transitive Dependencies

传递依赖

Now, look at the non-candidate keys (staffNo, comments, iTime (inspection time), sName, carReg). Within those, is there anything that is functionally dependent on the other? Yes, it is sName - given a staffNo, you can figure out the name of the staff member. But staffNo is functionally dependent on the 3 candidate keys. So by transitivity, propertyNo + iDate + pAddress -> staffNo -> sName, so sName is transitively dependent on staffNo. Transitive dependencies always relate to attributes outside of candidate keys.

现在,查看非候选键(staffNo、comments、iTime(检查时间)、sName、carReg)。在这些中,是否有任何功能上依赖于另一个的东西?是的,它是 sName - 给定一个员工号,您可以找出该员工的姓名。但是 StaffNo 在功能上依赖于 3 个候选键。所以通过传递性,propertyNo + iDate + pAddress -> staffNo -> sName,所以sName 传递依赖于 staffNo传递依赖总是与候选键之外的属性相关。

回答by Tony Andrews

Not quite. It would help to be more exact in your terminology: when you say things like "one or more primary keys" you (presumably) really mean "one or more of the columns of the primary key"?

不完全的。在您的术语中更准确会有所帮助:当您说“一个或多个主键”之类的东西时,您(大概)真的指的是“主键的一个或多个列”?

The distinction between a full and a partial dependency only arises when a key consists of more than one column (a composite key):

完全依赖和部分依赖之间的区别仅在键由多列(复合键)组成时出现:

1) Full dependencies are when the full key is required (all columns of the key) to determine another attribute.

1) 完全依赖是指需要完整键(键的所有列)来确定另一个属性时。

2) Partial dependencies are when the key is composite and some but not all of the columns of the key determine another attribute. (This may still be more than one column.)

2) 部分依赖是指键是复合的,并且键的部分但不是全部列确定了另一个属性。(这可能仍然不止一列。)

3) Transitive dependencies are as you said.

3)传递依赖如你所说。

回答by nvogel

Fully dependentmeans dependent on all the attributes in question, usually meaning all the attributes of a candidatekey. It doesn't have to be a key designated as "primary" because primary keys don't play any special role in dependency theory and normalization.

完全依赖意味着依赖于所讨论的所有属性,通常是指候选键的所有属性。它不必是指定为“主”的键,因为主键在依赖理论和规范化中没有任何特殊作用。

Partially dependentmeans dependent on a proper subset of those attributes, usually meaning a proper subset of some candidate key.

部分依赖意味着依赖于这些属性的适当子集,通常意味着某个候选键的适当子集。

Depending on the context, transitive dependencycan mean either one of the following:

根据上下文,传递依赖可能意味着以下任一情况:

(1) a dependency of the form A->B, B->C

(1) A->B, B->C 形式的依赖

(2) a dependency of the form A->B, B->C where B isn't a superkey

(2) A->B, B->C 形式的依赖,其中 B 不是超键

Almost always the term transitive dependency is used when referring to the situation described by (2) and has become virtually synonymous with that sense even though (1) is the more formally correct meaning.

在提到 (2) 所描述的情况时,几乎总是使用术语传递依赖,并且实际上已经成为该含义的同义词,即使 (1) 是更正式的正确含义。