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 to be made by person (s) occupying different hotel rooms, then this information should appear as an attribute of  

  1. A.

    Person

  2. B.

    Hotel Room

  3. C.

    Lodging

  4. D.

    None of these

Attempted by 1489 students.

Show answer & explanation

Correct answer: C

Answer: Store the rent payment as an attribute of the lodging relationship (the associative entity).

Reason: The rent payment describes a specific occupancy event which involves both a person and a hotel room. Because it depends on the combination of those two entities, it belongs to the relationship between them rather than to either entity alone.

  • Identify the many-to-many relationship: a person can occupy many rooms over time and a room can be occupied by many persons over time.

  • Create an associative entity (lodging) to represent the occupancy; include foreign keys referencing person and hotel room.

  • Add the rent payment as an attribute of that associative entity (for example: lodging.rent_payment). You can also include other occupancy details such as start_date and end_date.

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

Explore the full course: Gate Guidance By Sanchit Sir