Should database designs with different dates and different prices not use the start and end time?

the price of the hotel made now will change on a certain date. The database structure looks like this. Ignoring most of the fields, room_type is the id, price of the room type is bound to him.

</span>

+ () 3*4 + 1

<hr>

<hr>

<hr>

                                          130$   
                                 +-----------------+
                                 |                 |
                                 v                 v
                      150$
     +----------------------------------------------------------+
     |                                                          |
     v      120$                                                v
+-------------------+           
|                   |    
v                   v           
  +--------------------------------------------+
                                       

I want to inquire about the price from the start date to the end date. In fact, there are three paragraphs that are 120,150,130
. What are you going to do if they don"t conflict between the start and end times at the time of insertion.

May.10,2021

  1. I don't think it necessary to add begin_date , end_date fields
  2. to this table.
  3. for those whose prices change over time, price , begin_date , end_date and corresponding room types form a new table
  4. .
  5. query the table in table 2 based on the current or selected time. If you hit, you will use the price in table 2, and if you miss, you will use the default price in table 1.
  6. such a room can have multiple price ranges, which can reach the customized price for a certain period of time, or even can be superimposed. For example, the price from July to October is 100, but the price of Qixi Festival is 10, just take the latest value, or mark the top value.

there are not many theoretical problems

try to extract the theoretical entity object and do it according to the business form

for example, the price follows the room type, the room type can be priced according to the date, and the price of the order placed by the end user is an order record, which can be abstracted into a concrete physical table!

order record complete record information:
user information, room type, room number, order date, discount, etc.

I won't be specific about specific queries, because I don't know your actual business

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3d3c4-2c384.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3d3c4-2c384.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?