问题描述
我已经看到了很多有关完全功能依赖的示例,但是他们经常这样说:
I have seen many examples about fully functional dependencies, but they use to say that:
x-> y这样y不应由任何适当的形式确定
x->y such that y shouldn't be determined by any proper subset of x, x has to be a key.
但是,如果y是由x的适当子集或子集以外的属性确定的,那该怎么办。
But, what if y is determined by an attribute other than the proper subset or subset of x.
假设我有一个学生表,该表由rollno(主键),姓名,电话号码唯一性不为null,电子邮件地址唯一性不为null。
Suppose that I have a students table which consists of rollno(primary key), name, phone no unique not null, email unique not null.
由于rollno是主键,因此将其设为x并命名为y。
As rollno is a primary key, let it be x and take name as y.
现在x-> y,但是电话或电子邮件也可以确定不是x子集的y(name)。
now x->y, but phone or email also determine y(name) which are not subsets of x. Is this still called a fully functional dependent?
如果是,我们是否应该检查仅是x子集的y的行列式?
If yes, should we check the determinants of y which are only subsets of x?
如果否,我犯了什么错误?
If no, what is the mistake I did?
推荐答案
您很困惑完全功能依赖的定义与 2NF的定义。完全功能相关的定义与超级键或候选键或主键无关。对于2NF中的关系,如果 X是候选键 Y是非素数,则Y不能由X的任何适当子集。
You are confusing the definition of "full functional dependency" with the definition of "2NF". The definition of fully functionally dependent has nothing to do with superkeys or candidate keys or primary keys. And for a relation to be in 2NF, if X is a candidate key and Y is non-prime then Y can't be determined by any proper subset of X.
当Y在功能上也依赖于X的适当/较小子集时,函数X-> Y是部分的。否则,它是完整的。
A functional dependency X -> Y is partial when Y is also functionally dependent on a proper/smaller subset of X. Otherwise it is full. It doesn't matter what else is true.
超键是一列或一组列,从功能上确定每一列。如果内部没有更小的超级键,则它是候选键。当每个属性在功能上完全依赖于每个候选键时,关系就是2NF。
A superkey is a column or set of columns that functionally determines every column. If there is no smaller superkey inside it then it is a candidate key. A relation is in 2NF when every attribute is fully functionally dependent on every candidate key. It doesn't matter what else is true.
您可以选择一个候选键称为主键。因此,主键是候选键。否则,主键的概念与功能依赖项和规范化无关。
You can pick one candidate key to call primary key. So a primary key is a candidate key. Otherwise the notion of "primary key" is irrelevant to functional dependencies and normalization.
(在SQL中,主键
表示与 unique not null
相同,即 superkey 。仅当其中没有更小的超级键时,它才是候选键。因此,一个声明的 主键
甚至可能不是 主键。在SQL中,您不能将{}声明为超键。)
(In SQL primary key
means the same as unique not null
, namely superkey. Which is a candidate key only if there's no smaller superkey in it. So a set declared primary key
might not even be a primary key. And in SQL you can't declare {} as a superkey.)
主键是候选键,因此{ rollno
}确定每个属性,而{{code> rollno }确定每个属性。因此{}是{ rollno
}的唯一适当子集,不是一个超键。 (当表中最多只能有一行时,{}是超键。)但是{}-> 名称
仍然很有可能。 (如果 name
列一次最多只能包含一个名称。)然后{ rollno
}- > 名称
将是不完整的,因为其正确的子集{}确定名称
。
A primary key is a candidate key, so {rollno
} determines every attribute and no proper subset of {rollno
} determines every attribute. So {}, the only proper subset of {rollno
}, is not a superkey. ({} is a superkey when there can only ever be at most one row in the table.) But it's still possible that {} -> name
. (That would be if the name
column only contains at most one name at a time.) Then {rollno
} -> name
would be partial because its proper subset {} determines name
.
如果{{code> rollno }确定名称
,然后确定{ rollno
}-> 名称
全部,否则部分。这就是定义的意思。别的都无所谓。但是我们不知道 {{code> rollno }的适当子集是否确定 name
,因为您没有说{}-> 名称
。
If no proper subset of {rollno
} determines name
then {rollno
} -> name
fully, otherwise partially. That's what the definition says. Nothing else matters. But we don't know whether proper subset of {rollno
} determines name
because you didn't say whether {} -> name
.
如果{ rollno
},{ phoneno
}和{ email
}是候选键,{}不确定 name
然后 name
在功能上完全依赖于全部三个(因为其中任何一个子集都不能确定名称
)。
If {rollno
}, {phoneno
} and {email
} are candidate keys and {} doesn't determine name
then name
is fully functionally dependent on all three (because no proper subset of any of them determines name
).
这篇关于当x-> y和z-> y(其中z不是x的子集)时,FD(功能依赖)是否完全为fd?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!