Skip to main content
Skip to main content

nth_value

Returns the first non-NULL value evaluated against the nth row (offset) in its ordered frame.

Syntax

For more detail on window function syntax see: Window Functions - Syntax.

Parameters

  • x — Column name.
  • offset — nth row to evaluate current row against.

Returned value

  • The first non-NULL value evaluated against the nth row (offset) in its ordered frame.

Example

In this example the nth-value function is used to find the third-highest salary from a fictional dataset of salaries of Premier League football players.

Query:

Result: