Consider the following table in a relational database Last Name Rank Room…

2018

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?

  1. A.

    {Last Name}

  2. B.

    {Room}

  3. C.

    {Shift}

  4. D.

    {Room, Shift}

Attempted by 403 students.

Show answer & explanation

Correct answer: D

A candidate key must uniquely identify every row in a table. In the given data, individual attributes like Last Name or Room contain duplicates across rows. However, the combination of Room and Shift produces a unique value for each row (e.g., 33/Afternoon is distinct from 33/Evening). Since {Room, Shift} ensures uniqueness for all entries, it qualifies as a candidate key.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro