Aggregates Aggregate

first_value()

Arguments & returns

first_value(col0)

Aggregate
Overload link col0 Returns
#01 T T

Example

first_value example
SQL
Haybarn WASM 1.5.5-rc3 · 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 ↗