I am trying to get all rows across 1 month where the time_of_day is between 14:30 and 21:00. I tried the below
SELECT
extract(hour from timestamp),
extract(minute from timestamp),
*
from
trades
where
((extract(hour from timestamp) >= 14 and extract(minute from timestamp) <= 30)
and (extract(hour from timestamp) <= 21 and extract(minute from timestamp) >= 0))
and timestamp in '2024-02'
but it didn't work I see the data with 21:30 times in it. What's the best syntax to query the time interval of the day and ideally avoid full table scan?