user7215538
user7215538

Reputation: 1

SQL Updating tables. One contains foreign key

I am facing a problem with updating tables. I have two tables:

How can I update room price for specific roomId, but keep old value of price in Visit?

For example somebody booked room in hotel for 50$, but after he did it, the price changes to 60$. So I want to keep old price(50$) just for this client and for new ones use the new value (60$).

Thanks for responses

Upvotes: 0

Views: 49

Answers (1)

Gordon Linoff
Gordon Linoff

Reputation: 1269573

You have a slowly changing dimension. Probably the best approach is to keep the price in the visit table as well. You can call this the reservationPrice or something similar, to distinguish from the current price for the room.

Upvotes: 2

Related Questions