xxyyxx
xxyyxx

Reputation: 2396

How to determine if something should be an entity or an identifying relationship?

I'm trying to sketch out an ERD for booking hotel rooms. I had the "Reservation" as its own entity, so a User makes a reservation, and a reservation is for a room. But I guess it could also be an identifying relationship between the user and the room, as it joins them both. A user reserves a room. The reservation table would have a user_id and room_id. I would think other entities should be related to the reservation though, such as payment, rate of cost. Any input would help, I'm quite new to these. Thanks!

Upvotes: 0

Views: 517

Answers (1)

reaanb
reaanb

Reputation: 10064

An identifying relationship is the relationship between a weak entity and its parent entity. A weak entity is an entity that can't be identified by its own attributes and has another entity's key as part of its own.

Does this apply to your situation? Is a User partially identified by the Room they reserve, or a Room by the User who reserved it? I would think not.

The other possibility is to make Reservation a regular relationship. Can a Reservation be identified by some combination of the entities it's related to? I don't think so. I imagine any Reservation could be repeated at a later date, but dates are usually seen as value sets, not entity sets.

Reservation should probably be an entity set.

Upvotes: 1

Related Questions