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
Stretching Cambium's answer, if the PhoneNumber is also unique along with StudentNumber then candidate keys would be:- {StudentNumber},{PhoneNumber}.
Here we can't assume {StudentNumber,PhoneNumber} as a single candidate key because if we omit one attribute say StudentNumber we still get a unique attribute{PhoneNumber} thus, violating the definition of candidate key.
Primary key: Choose one candidate key out of all candidate keys. There are 2 candidate keys so we can choose {StudentNumber} as primary key.
Alternate keys: leftover candidate keys, after choosing primary key from candidate keys, are alternate keys i.e. {PhoneNumber}.
compound key: a compound key is a key that consists of two or more attributes that uniquely identify an entity occurrence. A simple key is one that has only one attribute. Compound keys may be composed of other unique simple keys and non-key attributes, but may not include another compound key.
composite key: A composite key contains at least one compound key and one more attribute. Composite keys may also include simple keys and non-key attributes.