简体   繁体   English

关于候选键和超级键

[英]Regarding Candidate Keys and Superkeys

I have a quick question regarding candidate keys and superkeys. 我有一个关于候选键和超级键的快速问题。 Say you have two keys (a, b) where 'a' is a primary key and b is a candidate key. 假设您有两个键(a,b),其中“ a”是主键,b是候选键。 Would the combination of these two keys be a superkey ie. 这两个键的组合是否为超级键,即。 would (a,b) be a superkey? (a,b)会成为超级键吗? Or would it be a candidate key. 还是将其作为候选密钥。 My assumption is that it would be a superkey because the definition of a candidate key states that it is a irreducible superkey and the combination of the two fields a and b could be reduced to either a or b. 我的假设是它将是一个超键,因为候选键的定义表明它是一个不可约的超键,并且两个字段a和b的组合可以减少为a或b。 Is this logic correct? 这个逻辑正确吗? Or am I missing something here? 还是我在这里想念什么? Thanks! 谢谢!

Would the combination of these two keys be a superkey ie. 这两个键的组合是否为超级键,即。 would (a,b) be a superkey? (a,b)会成为超级键吗?

Yes, it would still uniquely identify rows. 是的,它仍将唯一地标识行。

Or would it be a candidate key. 还是将其作为候选密钥。

No, it would no longer be minimal. 不,它不再是最小的。

My assumption is that it would be a superkey because the definition of a candidate key states that it is a irreducible superkey and the combination of the two fields a and b could be reduced to either a or b. 我的假设是它将是一个超键,因为候选键的定义表明它是一个不可约的超键,并且两个字段a和b的组合可以减少为a或b。 Is this logic correct? 这个逻辑正确吗?

Almost. 几乎。 Yes it would be a superkey, but not because it can be reduced. 是的,这将是一个超级键,但不是因为可以减少它。 It would be a superkey because it is unique. 这将是一个超级键,因为它是唯一的。

Every candidate key is superkey, but not every superkey is candidate key. 每个候选键都是超级键,但并非每个超级键都是候选键。 So {a} is both candidate and superkey, {b} is both candidate and superkey and {a, b} is just superkey. 因此{a}既是候选者又是超键, {b}既是候选者又是超键,而{a, b}只是超键。

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

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