Customers customerID C001 C002 C003 C004 firstName Tony Daniel Jimmy Jimmy lastN
ID: 3731874 • Letter: C
Question
Customers customerID C001 C002 C003 C004 firstName Tony Daniel Jimmy Jimmy lastName Sahama James immy ames email tony@gmail.com dan@yahoo.com phoneNumber 0432328888 0412348711 0725637822 0488226739 jimmy@gmail.com Hosts hostID H001 H002 H003 H004 H005 name Joe Hockey Malcom Turnbull Richy Rich Empire Builder Richy Rich address 101 Blue St 22 Riverview Ro 99 Penthouse Dr 01 Mountain Rd 22 Kiribilli St Bookings hostID H002 H004 H001 H004 H002 customerID C001 C002 C001 C004 C001 dateFrom 20/08/2018 25/08/2018 24/08/2018 25/08/2018 30/08/2018 numberOfNights bookinglD B001 B002 B003 B004 B005 Consider the tables above that show the relations and the existing tuples within the Hire a Holiday Home relational schema. Currently the database only has a few tuples in each relation. However, it will store significantly more information in the future. Note: there can only be one host at a given address, a customer can only book with one host for any given night (they cannot book for someone else) Choose the correct answer below for the following How many superkeys are there in the Hosts relation?v How many candidate keys are there in the Bookings relation?Explanation / Answer
Before getting to your answer, Let me clear the concepts first.
A super key is any combination of the given fields in one table, which can be used to identify each row uniquely present in the table.
In more technical details, a super key can be defined as a set of attributes whose values can be used to identify the tuples present in the table uniquely.
Now getting back to the 1st answer :
There are total 7 super keys present in the Hosts relation,
hostid+name+address = 3 (Each fied represent a super key)
(hostid+name)+(name+address)+(hostid+address) = 3 (Set of 2 fields represent a super key)
(hostid+name+address) = 1 (All the 3 fields combined to form a single super key)
Thus 3+3+1 = 7.
Now Getting to the second question.
A candidate key is a key which is unique in behavior and can be promoted to primary key. In any schema there can be multiple candidate keys out of which the key(also known as a column), which can uniquely identify the record without referring to the other data present at the table is called as a primary key.
The answer for the 2nd question would be :
Out of all the 5 columns in the Bookings relation, The bookingID, hostID, customerID are unique for each customer, thus they are the candidate keys for the given relation
But note that there are duplicate values in fields hostID and customerID.
While the bookingID field describes unique values in its field, thus it can be promoted to primary key.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.