nth_value
analytic window function
Applies to: Databricks SQL Databricks Runtime
Returns the value at a specific offset
in the window.
Arguments
expr
: An expression of any type.offset
: An INTEGER literal greater than 0.IGNORE NULLS
orRESPECT NULLS
: WhenIGNORE NULLS
is used, anyexpr
value that is NULL is ignored in the count. The default isRESPECT NULLS
.OVER clause: The clause describing the windowing. See: Window functions.
Returns
The result type matches the expr
type.
The window function returns the value of expr
at the row that is the offset
th row from the beginning of the window frame.
If there is no such offset
th row, returns NULL
.
You must use the ORDER BY clause clause with this function. If the order is non-unique, the result is non-deterministic.