clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 995126 fiddles created (10902 in the last week).

create table mytable (start_time time, end_time time); insert into mytable values ('09:00:00', '15:00:00'), ('17:00:00', '22:00:00');
2 rows affected
 hidden batch(es)


select * from ( select '06:00:00'::time start_time, min(start_time) end_time from mytable union all select end_time, lead(start_time) over(order by start_time) from mytable union all select max(end_time), '23:59:59'::time from mytable ) t where start_time <> end_time
start_time end_time
06:00:00 09:00:00
15:00:00 17:00:00
22:00:00 23:59:59
 hidden batch(es)