LEAD
Takes a value from the next row to compare with the current one.
Syntax
LEAD(<expression>) OVER (ORDER BY <sort key>)
LEAD(<expression>, <offset>, <default>) OVER (ORDER BY <sort key>)
LEAD(<expression>) OVER (PARTITION BY <group> ORDER BY <sort key>)
The mirror of LAG: it looks at the row below in the given order and returns a value from it. The offset is how many rows forward (1 by default), and the third argument is used when there's no next row. Handy for finding out what came “after”: when the next order arrived and how much time passed before it.