hi;

here is a part of my ERD "Hotel Reservation system"
and there is a relationship with 3 entities included in it.

they are:
customer
Reservation
Room

the relationship between them is "assign to"

I make it as 1 to 1 relationship

and i want to know than , how to make normalization for it?

take the pk of one of them to the other remaining entity
and thats it !

or what ?

Recommended Answers

All 2 Replies

Assuming you do want a 1-to-1 relationship between each entity, then you just need to have one entity with a primary key and the others to have foreign keys to the primary key. If that is your normalized form, then a person can book only one room and one room can only be booked by one person. Even after the person checks out, noone else can book the room and that person can never book another room.

What you probably want is a 1-to-1 relationship between those tables. If you had a 1-to-1 relationship, once a room is booked, it can never be booked again. What you want is a 1-to-many relationship from customer to reservation and a 1-to-many relationship from room to reservation.

Assuming you do want a 1-to-1 relationship between each entity, then you just need to have one entity with a primary key and the others to have foreign keys to the primary key. If that is your normalized form, then a person can book only one room and one room can only be booked by one person. Even after the person checks out, noone else can book the room and that person can never book another room.

What you probably want is a 1-to-1 relationship between those tables. If you had a 1-to-1 relationship, once a room is booked, it can never be booked again. What you want is a 1-to-many relationship from customer to reservation and a 1-to-many relationship from room to reservation.

i got your point , thanks alot
and I did it , but the real Q was the other relation showing in the following ERD
which is "assign to "
is it correct to be 1-to-1 relationship ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.