Skip to main content
Returns the value of the input expression at the given offset before the current row within the requested window. For more information on usage, please refer to Window Functions.

Syntax

Parameters

Example

In the example below, LAG returns the nickname of the player one position behind (player_before) and one position ahead (player_after) in alphabetical order within each level. NULL is returned when no row exists at the given offset.

Rows: 4Execution time: 6.89ms