0

I want to get ideas for database design for a facility booking system. Here is what is in my mind:

Bookings:
- id
- facility
- Start Datetime
- End Datetime

The reason I'm asking is, during booking process I need to check if the facility is available or not.

Is the below method appropriate or there is better method for this checking?

if ( ( (newStartDatetime >= bookedStartDateTime) && (newStartDatetime < bookedEndDateTime) ) || ( (newEndDatetime > bookedStartDateTime) && (newEndDatetime =< bookedEndDateTime) ) ) {
    // The facility is booked
}
010 Pixel
  • 195
  • 3
  • 14

0 Answers0