The Gateway to Computer Science Excellence
+1 vote
948 views

Considering the following table in a relational database

Last Name Rank Room Shift
Smith Manger 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?

  1. {Last Name}
  2. {Room}
  3. {Shift}
  4. {Room, Shift}
in Others by Veteran (425k points)
edited by | 948 views

3 Answers

+5 votes
Best answer
Candidate key:- must be able to uniquely determine every other attribute. i.e., whenever a candidate key value is repeated, all other values must repeat or in a set, candidate key cannot be repeated.

option

a:- Last Name cannot be key as smith value are repeated.

b.Room:- 33 value is repeated

c.shift:- morning repeated

d. Composite key Room+shift => Every tuple is now unique

234+morning

33+afternoon

33+evening

222+morning.

so Option D is right
by Active (3.2k points)
edited by
+1 vote
option D is correct. room, shift is a set of column that uniquely identify the database record.
by Active (1.3k points)
0 votes
Option D is correct as we cannot make only room as candidate key it may lead to ambiguity.
by (19 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,645 questions
56,615 answers
195,895 comments
102,338 users