first_value()

The first value of expr in the frame. Can IGNORE or RESPECT NULLS.

Reference: DuckDB 2.0.0

Arguments & returns

first_value(expr)

window
Overload link expr Returns
#01 ANY ANY
first_value example
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Engine example with sample data · Run to view results.

More examples

first_value example 2
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Guide example · Run to view results.

In other engines

Apache Hivefirst_value()

SELECT FIRST_VALUE(sample_col, TRUE)
In DuckDB
SELECT FIRST_VALUE(sample_col IGNORE NULLS)

SQLGlot example ↗

Apache Spark

SELECT ANY_VALUE(col, true), FIRST(col, true), FIRST_VALUE(col, true) OVER ()
In DuckDB
SELECT ANY_VALUE(col), ANY_VALUE(col), FIRST_VALUE(col IGNORE NULLS) OVER ()

SQLGlot example ↗