Question 5
Consider the following table in a relational database
Consider the following table in a relational database
Last Name | Rank | Room | Shift |
---|---|---|---|
Smith | Manager | 234 | Morning |
Jones | Custodian | 33 | Afternoon |
Smith | Custodian | 33 | Evening |
Doe | Clerical | 222 | Morning |
According to the data shown in the table, which of the following could be a candidate key of the table?
(a) { Last Name}
(b) { Room }
(c) { Shift }
(d) { Room, Shift }
Correct answer: (d) { Room, Shift }
Explanation:
Explanation:
Candidate key is the attribute or set of attribute which uniquely identifies the tuple.
Smith not uniquely identifies the tuple: as Smith-> manager (Rank) and Smith-> Custodian (Rank).
Similarly, Room gives different Shift value for key 33 (Room).
Similarly, Shift gives different Room value for key Morning (Shift).
So, after combining the { Room, Shift } as a candidate key to uniquely identify the tuples.
No comments:
Post a Comment