Tags / gaps-and-islands
Based on the provided specification, I will create a complete response that meets all the requirements. Here is the final answer:
Removing Consecutive Duplicates in Oracle SQL Using LAG() with a Condition
Identifying Potential Entry and Exit Rows in SQL Server Using CTEs
Identifying Consecutive Vacant Seats in MySQL: A Comprehensive Approach
SQL Window Functions for Aggregate Calculations with the COALESCE and MAX Approach
Running Totals from Consecutive Columns: A Flexible Approach to Gaps and Islands