reduce()

Reduces all elements of the input list into a single scalar value by executing the lambda function on a running result and the next list element. The lambda function has an optional initial_value argument.

Reference: DuckDB 2.0.0

Alias of list_reduce()

Arguments & returns

2 overloads

reduce(list, lambda)

Scalar
Overload link listlambda Returns
#01 ANY[]LAMBDA ANY

reduce(list, lambda, initial_value)

Scalar
Overload link listlambdainitial_value Returns
#02 ANY[]LAMBDAANY ANY

Example

reduce example
SQL
Haybarn WASM 2.0.0-rc12 · In your browser

Engine example · Run to view results.