Q&A for those who study, teach, research and apply economics and econometrics
SELECT prev_Id, Id, diff, CreationDate FROM (SELECT *, LAG(Id) OVER(ORDER BY Id) as prev_Id, Id - LAG(Id) OVER(ORDER BY Id) as diff from PostsWithDeleted ) as t where t.diff > 1 ORDER BY prev_Id