Consider the entities 'Hotel Room' and 'Person' with a many-to-many…

2005

Consider the entities 'Hotel Room' and 'Person' with a many-to-many relationship, 'Lodging', as shown below:

er00

If we wish to store information about the rent payment made by people occupying different hotel rooms, this information should appear as an attribute of:

Answer: C. LodgingConceptIn an ER model, an attribute is placed on the construct whose identity functionally determines that fact. Entity attributes describe one entity…

  1. A.

    Person

  2. B.

    Hotel Room

  3. C.

    Lodging

  4. D.

    None of these

Attempted by 2120 students.

Show answer & explanation

Correct answer: C

Concept

In an ER model, an attribute is placed on the construct whose identity functionally determines that fact. Entity attributes describe one entity instance; relationship attributes describe a particular association among participating entity instances.

Application

  1. Take a person P and two rooms R1 and R2. P may have separate lodging occurrences with R1 and R2, and the payment can differ between those occurrences.

  2. A value stored only on Person would give P one person-level payment and could not distinguish the room-specific lodging occurrences.

  3. A value stored only on Hotel Room would give each room one room-level payment and could not distinguish which person or lodging occurrence made it.

  4. The pair (P, R1) identifies one Lodging relationship instance, while (P, R2) identifies another, so occurrence-specific payment data is determined by the Lodging association.

Cross-check and contrast

  • Person is appropriate for person-specific facts that do not vary by room.

  • Hotel Room is appropriate for room-specific facts that do not vary by occupant.

  • Lodging is appropriate for facts that vary with the person–room association; in a relational design, an associative table can store the two foreign keys and the payment.

  • None of these is unnecessary because ER relationships are allowed to carry attributes.

Therefore, the rent payment should appear as an attribute of Lodging.

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

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…