Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic…

20132013

Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values.
F = {CH → G, A → BC, B → CFH, E → A, F → EG} is a set of functional dependencies (FDs) such that F+ is exactly the set of FDs that hold for R. How many candidate keys does the relation R have?

  1. A.

    3

  2. B.

    4

  3. C.

    5

  4. D.

    6

Attempted by 563 students.

Show answer & explanation

Correct answer: B

Concept

A candidate key is a minimal set of attributes whose attribute closure yields all attributes of the relation. Two facts drive the count: (1) an attribute that appears on no right-hand side of any FD is essential — it can be derived by nothing else, so it must lie in every candidate key; (2) when a group of attributes are mutually derivable (each reachable from the others), they are interchangeable, so swapping one for another in a key produces another key of the same size.

Setting up

  • Attributes: {A, B, C, D, E, F, G, H}

  • FDs: CH → G, A → BC, B → CFH, E → A, F → EG

  • Attributes appearing on some RHS: A, B, C, E, F, G, H

D appears on no right-hand side, so D is essential and must lie in every candidate key. The attributes C, G and H, although some appear on a left-hand side, cannot determine any of A, B, E or F (for instance CH yields only G), so they can never start a minimal key — they only ever appear inside non-minimal superkeys.

Finding the interchangeable group

Trace the determines-relation among the remaining attributes:

  • E → A

  • A → BC, so A → B

  • B → CFH, so B → F

  • F → EG, so F → E

This forms the cycle E → A → B → F → E. Hence A, B, E, F are mutually derivable — any one of them reaches all four.

Application — verify a key

Pair the essential attribute D with one member of the cycle and compute the closure of {A, D}:

  1. Start: {A, D}.

  2. A → BC adds B, C → {A, B, C, D}.

  3. B → CFH adds F, H → {A, B, C, D, F, H}.

  4. F → EG adds E, G → {A, B, C, D, E, F, G, H} = all attributes.

So {A, D} is a key, and it is minimal (dropping either attribute fails to reach all). Because A, B, E, F are interchangeable, replacing A with B, E or F gives a key each time:

  • {A, D}

  • {B, D}

  • {E, D}

  • {F, D}

Cross-check

Could any other minimal key exist? C, G, H determine nothing outward, so no key can be built around them; D alone reaches nothing; and any pair already containing one of A/B/E/F together with D is one of the four above. No further minimal key is possible.

Number of candidate keys: 4.

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

Explore the full course: Gate Guidance By Sanchit Sir