I have a table data with two fields time and value.
Table Data
| time | value |
|----------------------|------------------|
|"2020-05-31 17:16:48" | 132.868607594937 |
|"2020-05-31 17:31:12" | 74.1302380952381 |
|"2020-05-31 17:45:36" | 27.9773333333333 |
|"2020-05-31 18:00:00" | NULL |
|"2020-05-31 18:14:24" | NULL |
|"2020-05-31 18:28:48" | NULL |
|"2020-06-01 05:16:48" | NULL |
|"2020-06-01 05:31:12" | NULL |
|"2020-06-01 05:45:36" | 10.3688461538462 |
|"2020-06-01 06:00:00" | 0.5295 |
|"2020-06-01 06:14:24" | 0.516052631578947|
As you can see there are rows in the table with and without values. I'd love to build a table that would list intervals when there were and were not values coming. It would look like this:
Table: Results
| startTime | endTime | hasValues |
|----------------------|-----------------------|-----------|
|"2020-05-31 17:16:48" | "2020-05-31 18:00:00" | true |
|"2020-05-31 18:00:00" | "2020-06-01 05:45:36" | false |
|"2020-06-01 05:45:36" | "2020-06-01 06:14:24" | true |
How can I do it? I'm using Postgres 12.