3NF的定义 [英] Definition of 3NF

查看:382
本文介绍了3NF的定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对3NF的定义感到困惑。

设R是与属性集X的关系。

假设Y-> A是一个函数依赖项,其中A是

I'm rather confused about the definition of 3NF.
Let R be a relation with attribute set X.
Suppose Y -> A is a functional dependency where A is a non-prime attribute and Y is a subset of X.

如果Y是R的任何候选键的适当子集,则该关系不在3NF中(并且

If Y is a proper subset of any candidate key for R, then the relation is not in 3NF (and not even in 2NF) because this is a partial dependency, which is not permitted in 2NF (and by extension 3NF).

如果Y是非素数属性,则关系不是在3NF中,因为这是非素数属性A通过非素数属性Y对任何候选键的传递依赖。

If Y is a non-prime attribute, the relation is not in 3NF because this is a transitive dependency of the non-prime attribute A on any candidate key through the non-prime attribute Y.

但是如果Y为包含素数和非素数属性的集合?如果A是Y的子集怎么办?如果Y仅包含素数属性,但是那些素数属性来自R的不同键怎么办,那么Y并不是R的任何特定键的适当子集,该怎么办?如果Y仅包含但有多个非素数属性怎么办?其中哪种情况违反了3NF的要求?为什么?

But what if Y is a set containing both prime and non-prime attributes? What if A is a subset of Y? What if Y contains only prime attributes, but those prime attributes come from different keys of R so that Y is not a proper subset of any particular key of R? What if Y contains only, but multiple non-prime attributes? Which of these cases violates the requirements of 3NF and why?

推荐答案

TL; DR 直接获取定义。

要了解案件是否违反3NF,您必须查看某些定义中使用的标准。 / strong>

To know whether a case violates 3NF you have to look at the criteria used in some definition.

您的问题就像问一样,我知道一个偶数是一个可以被2整除的数,或者是一个小数表示为0、2、4的数字。 6或8,但如果是正方形的三倍呢?好吧,您必须使用定义-显示给定条件意味着它可以被二整除,或者其十进制表示形式以这些数字之一结尾。为什么您甚至还关心定义中不包含的其他属性?

Your question is rather like asking, I know an even number is one that is divisible by 2 or one whose decimal representation ends in 0, 2, 4, 6 or 8, but what if it's three times a square? Well, you have to use the definition--show that the given conditions imply that it's divisible by two or that its decimal representation ends in one of those digits. Why do you even care about other properties than the ones in the definition?

当某些FD(功能依赖项)成立时,其他FD也必须成立。我们说后者隐含着前者。因此,当给定的FD通常持有其他成千上万的FD时。因此,持有一个或多个任意FD并不一定告诉您任何可能存在的正常形式的信息。例如,当U是V的超集时,U→V必须成立;此类FD称为平凡的,因为任何FD集合都暗含了它们。例如,当U→V时,U的每个超集确定V的每个子集。阿姆斯特朗公理是一些规则,可以机械地应用来找到所有持有的FD。有一些算法可以找到给定集合的<规范>最小/不可约覆盖,这是一组FD,意味着其中的所有FD都没有适当的子集。还有一些算法可以确定某种关系是否满足某些NF(正常形式),并在不满足某些条件时将它们分解为具有更高NF的组件。

When some FDs (functional dependencies) hold, others must also hold. We say the latter are implied by the former. So when given FDs hold usually tons of others also hold. So one or more arbitrary FDs holding doesn't necessarily tell you anything about any normal forms might hold. Eg when U is a superset of V, U → V must hold; such FDs are called trivial because they are implied by any collection of FDs. Eg when U → V, every superset of U determines every subset of V. Armstrong's axioms are some rules that can be mechanically applied to find all FDs that hold. There are algorithms to find a canonical/minimal/irreducible cover for a given set, a set of FDs that imply all those in it with no proper subset that does. There are also algorithms to determine whether a relation satisfies certain NFs (normal forms), and to decompose them into components with higher NFs when they're not.

有时我们认为有一种情况,该定义无法处理,但实际上我们弄错了定义。

您要引用的定义因为3NF中的关系实际上要求候选键上没有非素数属性的传递函数依赖性。

The definition you are trying to refer to for a relation being in 3NF actually requires that there be no transitive functional dependence of a non-prime attribute on a candidate key.

在您的非3NF示例中,您应该说存在传递式FD,而不是这是传递式FD,因为违反的FD的格式为 CK →A而不是Y→A。此外,U→V当存在X时,U→X AND X→V而不是X→V是可传递的。X是否为素数属性无关紧要。

In your non-3NF example you should say there is a transitive FD, not "this is a transitive FD", because the violating FD is of the form CK → A not Y → A. Also, U → V is transitive when there is an X where U → X AND X → V AND NOT X → V. It doesn't matter whether X is a prime attribute.

PS 在数学中问为什么是不是很有帮助。我们用一些给定来描述一种情况,随后发生了很多事情。我们可以说,如果某些特定条件不是这样,那事情就不是这样。但是,如果某些其他人给予的不是,那么也可能不是。我们可以证明某事是或不是,例如为什么,但这不是唯一的证明。

PS It's not very helpful to ask "why" something is or isn't so in mathematics. We describe a situation in terms of some givens, and a bunch of things follow. We can say that if certain of the givens weren't so then that thing wouldn't be so. But if certain other givens weren't so then it might also not be so. We can give a proof that something is or isn't so as "why" but it's not the only proof.

这篇关于3NF的定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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