I was teaching a class today on more advanced SQL queries and we were discussing if you could use preceding and following in a single windowing function.
If you’re not familiar with windowing functions, they’re really cool. You can perform all kinds of trickery and magic with them. Let’s start with a simple example.
The dataset I’m using has flight data from the early 2000’s.
Read on for the example and for the answer to Reitse’s question.