Tags / gaps-and-islands
Filling Missing Dates in PostgreSQL with Zero Using generate_series Function
Creating Date Ranges from Multiple Rows Based on a Single Date
SQL Running Total with Cumulative Flag Calculation Using Common Table Expression
Based on the provided specification, I will create a complete response that meets all the requirements. Here is the final answer:
Finding the Longest Negative Series in PostgreSQL: A Step-by-Step Solution
Creating Time Windows with Alternating Values in T-SQL