Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

cjconnor24's avatar

Booking System - Generic Data Modelling Question

Hi guys,

I am a software development student and have a super-generic question for you experienced devs out there.

I am working on a small system to handle holiday let bookings and I just wanted your thoughts on how you think this should work.

So far, i've came up with the following data model: alt text

Which, I guess, seems fine.

My biggest puzzle would be...how would I then check for availability based on existing bookings?

Say there was an existing booking 2017-07-01 -> 2017-07-14

SELECT * FROM bookings WHERE checkin <= '2017-07-07' AND checkout >= '2017-07-10';

Would discover show that the 2017-07-01 -> 2017-07-14 already exists...but wouldn't for instance find a booking if the proposed date was 2017-06-28 -> 2017-07-20.

I suppose my question is - am I on the right track with my data model? And just need to find a way to query properly - or I am barking up the wrong tree with my model.

Like I said, I'm a second year software development uni student so be gentle :)

Thanks in advance,

(p.s. obviously down the line this will be implemented with ORM, but it's more just to get my head around things)

0 likes
0 replies

Please or to participate in this conversation.