Aggregates Aggregate

first_value()

Reference: DuckDB 1.5.5

Arguments & returns

first_value(col0)

Aggregate
Overload link col0 Returns
#01 T T
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 ↗