In: Computer Science
For the following schema, provide the following unique/distinct values
a) A suitable primary key
b) An example of a different candidate key
c) An example of a superkey
Accounts(account_id, account_type_code, customer_id, account_name, date_opened, date_closed, current_balance)
Please find your answers with definition which will help you to understand the concept as well.
a). Ans -> account_id/customer_id
primary key of a set of attribute which can uniquely identify a tuple. Here both account_id or customer_id can uniquelly identify the rows uniquily as these vlues are unique for rach customer. Prinamy key can be combination of account_id_customer_id as well. There can be more than one candidate key in relation out of which one can be chosen as the primary key.
b). account_id/customer_id but not account_id_customer_id as the definition of Cndidate key states that The minimal set of attribute which can uniquely identify a tuple is known as candidate key. so account_id/customer_id is minimal but not account_id_customer_id as it's a combination of two PK's.
c). (account_id, account_type_code), (account_id, customer_id),(account_id, customer_id), (account_id, date_opened)..etc
(customer_id, account_id), (customer_id, date_opened), (customer_id, date_closed), (customer_id, current_balance) .. etc
The set of attributes which can uniquely identify a tuple is known as Super Key.