Here is your current request:
SELECT start_break, finish_break FROM break_time WHERE start_break AND finish_break BETWEEN '08:00:00' AND '17:00:00'
The WHERE indicates where start_break is true and finish_break is between 8:00 and 17:00. This is probably not what you want, because start_break will always evaluate to true. From the MySQL documentation:
MySQL computes any nonzero value other than NULL to TRUE
Besides the logical problem in the WHERE , you also tried to compare the start and end columns directly with a time string. This will not work if these columns are also not time, which I doubt.
Here is a query that you probably logically assumed:
SELECT start_break, finish_break FROM break_time WHERE DATE_FORMAT(start_break, '%H:%i:%s') BETWEEN '08:00:00' AND '17:00:00' AND
The columns are assumed to be start_break and end_break datetime columns, and you want to compare the time of day.
source share