Identify missing hours - find the gaps in time
问题 I have a table with hours, but there are gaps. I need to find which are the missing hours. select datehour from stored_hours order by 1; The gaps in this timeline are easy to find: select lag(datehour) over(order by datehour) since, datehour until , timestampdiff(hour, lag(datehour) over(order by datehour), datehour) - 1 missing from stored_hours qualify missing > 0 How can I create a list of the missing hours during these days? (with Snowflake and SQL) 回答1: To create a list/table of the