I am managing an event database. Every event has a start and end timestamp (INT, unix timestamp).
Currently i\'m able to do the following things with a sing
If I get the question right, with [:start, :end] being your date range of interest, you're looking for:
select *
from event
where -- event started earlier, ends later
start <= :start and :start <= end
or -- event starts during [:start, :end]
:start <= start and start <= :end
or -- event ends during [:start, :end]
:start <= end and end <= :end;
If you're looking for a particular :day, use :day as :start and :day + 1 day as :end.