简体   繁体   中英

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. Would the combination of these two keys be a superkey ie. would (a,b) be a superkey? 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. 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?

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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