Skip to content
Advertisement

SQL: Split time interval into intersects of one hour

I am new to SQL, where I am trying to split time intervals into multiple rows of one hour, together with an indicator of how many minutes the interval overlaps each hour.

My data:

What I would like:

What would be the easiest/fastest way to do this?

Advertisement

Answer

Try something like this:

demo

Result for sample data

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement