I am trying to create booking system, MySQL table has this row
Room Id | Start (DateTime) | | Finish(DateTime)
13 2014-10-20 08:30 | 2014-10-20 18:30
And I want to block any entries between these start and finish
eg:
Room id: 13
Start: 2014-10-20 10:30
Finish: 2014-10-20 12:30
To do that I have wrote this MySQL query, is this SQL correct?
SELECT *
FROM rooms
WHERE room_id='13'
AND ('2014-10-20 12:30:00' <= start_time OR '2014-10-20 10:30:00'>=finish_time)
In here I tried to skip between result, please advise me.