list_filter()

Constructs a list from those elements of the input list for which the lambda function returns true. DuckDB must be able to cast the lambda function's return type to BOOL. The return type of list_filter is the same as the input list's.

Arguments & returns

list_filter(list, lambda(x))

Scalar
Overload link listlambda(x) Returns
#01 ANY[]LAMBDA ANY[]

Example

list_filter example
SQL
Haybarn WASM 1.5.5-rc3 · In your browser

Engine example · Run to view results.

In other engines

Snowflakearray_remove()

ARRAY_REMOVE([1, 2, 3], 2)
In Haybarn
LIST_FILTER([1, 2, 3], _u -> _u <> 2)

SQLGlot example ↗