Mysql SELECT query for getting available rooms in a building

I have a problem to write MySQL SELECT query in which I can get list of free rooms in a time slot with a specific date range.

So I am using two tables named spaces and bookings

spaces:enter image description here

Bookings:enter image description here

I need to show the free rooms in the search page that satisfied with the search criteria. The search form looks like: enter image description here

Users can choose maximum days range and can able to choose time range. The time range may be the midnight.

How should I retrieve all the available rooms with criteria described above?

Thanks in advance…