Superkey, candidate key & primary key

后端 未结 3 910
独厮守ぢ
独厮守ぢ 2021-01-30 03:35

Can any kind soul clarify my doubts with a simple example below and identify the superkey, candidate key and primary key?

I know there are a lot of posts and websites ou

3条回答
  •  情书的邮戳
    2021-01-30 03:49

    A superkey is any set of attributes for which the values are guaranteed to be unique for all possible sets of tuples in a table at all times.

    A candidate key is a "minimal" superkey - meaning the smallest subset of superkey attributes which are unique. Removing any attribute from a candidate key would therefore make it non-unique.

    A primary key is just a candidate key. There is no difference between a primary key and any other candidate key.

    It's not really useful to make assumptions about keys based only on a list of attribute names. You need to know what dependencies are supposed to hold between the attributes. Having said that, my guess is that you are right - StudentNumber is likely a candidate key in your example.

提交回复
热议问题