本文介绍了正常形式 - 2nd vs 3rd - 区别只是复合键吗?非平凡的依赖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经查看了这篇文章,但我并不真正理解所使用的术语(非平凡的函数依赖,超键)

I've viewed This post but I don't really understand the terms used (non-trivial function dependency, superkey)

从我读过的内容来看,第二范式似乎与复合键有关,而第三范式与主键有关.

From what I've read 2nd normal form seems to relate to composite keys whereas 3rd normal form relates to primary keys.

我不确定这是否正确.

所以第二范式 - 有一个复合键,表中的所有字段都必须与两个复合键字段相关.如果某些内容不相关,则应将其重构到另一个表中.

So 2nd normal form - there's a composite key and all fields in the table must relate to both of the composite key fields. If something doesn't relate then it should be refactored into another table.

第三范式 - 一切都必须依赖于主键 - 所以我猜在第三范式中只有 1 个键,而不是在可以有复合键的第二范式中?

3rd normal form - everything has to be dependent on the primary key - so I'm guessing that in 3rd normal form there's only 1 key rather than in 2nd normal form where there can be composite keys?

任何建议表示赞赏.

推荐答案

我们写 S ->T 并假设一组列 S 在功能上确定另一组 T.当第一个子行的每个子行始终与第二个子行一起出现时,表中的 T 值.S->当 S -> 时,表变量/模式中的 TT 在每个约束条件下可能出现的值中.

We write S -> T and say that a set of columns S functionally determines another set T. S -> T in a table value when each subrow for the first always appears with the same subrow for the second. S -> T in a table variable/schema when S -> T in every value that can arise for it per the constraints.

我们说S是行列式集,T是确定集.我们称 S ->T a FD(函数依赖).当 S 是 T 的超集时,我们说它是一个平凡的 FD.当 S 是 {A} 时,我们说 A ->与当 T 是 {A} 时,我们说 S ->A.

We say S is the determinant set and T is the determined set. We call S -> T a FD (functional dependency). When S is a superset of T we say it is a trivial FD. When S is {A} we say A -> T & when T is {A} we say S -> A.

超级键是一组唯一标识行的列.当它在功能上确定每个属性时就是这样.集合的真子集或超集不等于它.CK(候选密钥)是不包含正确超级密钥的超级密钥.我们可以选择一个 CK 作为 PK(主键).列在某个 CK 中时是素数.

A superkey is a set of columns that uniquely identifies rows. That is so when it functionally determines every attribute. A proper subset or superset of a set is one that is not equal to it. A CK (candidate key) is a superkey that contains no proper superkey. We can pick a CK as PK (primary key). A column is prime when it is in some CK.

这足以理解您链接到的答案:

That's enough to understand the answer that you link to:

2NF 和 3NF 的区别就是这个.假设某种关系满足形式 A->B 的非平凡函数依赖,其中B 是非素数属性.

如果 A 不是超键而是 A 的真子集,则违反了 2NF候选键

2NF is violated if A is not a superkey but is a proper subset of acandidate key

如果 A 不是超键,则违反 3NF

3NF is violated if A is not a superkey

引用说 NF如果"被违反了这样的FD存在.此外,如果存在这样的 FD,它被违反.

The quote says a NF "is violated if" such an FD exists. Also it's only violated if such an FD exists.

FD S ->当 S 的真子集在功能上也决定了 T 时,T 是部分的;否则就满了.请注意,这不涉及 CK.当每个非主列在功能上完全依赖于每个 CK 时,一个表处于 2NF.

A FD S -> T is partial when a proper subset of S also functionally determines T; otherwise it is full. Note that this does not involve CKs. A table is in 2NF when every non-prime column is fully functionally dependent on every CK.

S ->当存在 X 时 T 是可传递的,其中 S ->X 和 X ->T 而不是 X ->S 而不是 X = T.请注意,这不涉及 CK.当每个非主列都非传递性地依赖于每个 CK 时,表就属于 3NF.

S -> T is transitive when there is an X where S -> X and X -> T and not X -> S and not X = T. Note that this does not involve CKs. A table is in 3NF when every non-prime column is non-transitively dependent on every CK.

(注意 2NF 和 3NF 的替代定义与引用不同.)

(Note the alternate definitions of 2NF & 3NF different from the quote.)

这篇关于正常形式 - 2nd vs 3rd - 区别只是复合键吗?非平凡的依赖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-20 08:12