Find the Missing Days (Gaps & Islands) | Algorithm
Hardgaps-and-islandsSQL
Find the Missing Days (Gaps & Islands)
The 'IN' region's daily data has a gap — some consecutive dates are missing entirely. Return the day where the data resumes after the gap, along with how many days elapsed since the previous recorded day (day_gap). Only return rows where day_gap is greater than 1 (i.e. only the row(s) right after a real gap).
Expected output
day
day_gap
1 row — values hidden, that's the puzzle
Your query should return 1 row with these columns. Your column aliases don't need to match.