* Let K Í R
* K is a superkey of R if values for K are
sufficient to identify a unique tuple of each possible relation r(R)
# by “possible r ” we mean a relation r that could exist in the
enterprise we are modeling.
# Example: {customer_name, customer_street} and
{customer_name}
are both superkeys of Customer, if no two customers can possibly have the same name
{customer_name}
are both superkeys of Customer, if no two customers can possibly have the same name
4In real life, an
attribute such as customer_id would be used instead of customer_name to uniquely identify
customers, but we omit it to keep our examples small, and instead assume
customer names are unique.
Keys (Cont.)
nK is a
candidate
key if K is
minimal
Example: {customer_name} is a candidate key for Customer, since it is a superkey and no subset of it is a superkey.
Example: {customer_name} is a candidate key for Customer, since it is a superkey and no subset of it is a superkey.
nPrimary key: a candidate key chosen as the principal means of
identifying tuples within a relation
lShould choose an
attribute whose value never, or very rarely, changes.
lE.g. email address is
unique, but may change
No comments:
Post a Comment