Categories: Semi-Structured Data
ARRAY_REMOVE
Removes all elements that equal a given value from a list.
Syntax
ARRAY_REMOVE(list_column LIST, value any) → list
- list_column: Column that contains a LIST expression. Cannot be an array literal.
- value: An expression of any data type.
Examples
array_col contains ARRAY[1, 2, 3]SELECT ARRAY_REMOVE(array_col, 1)
-- [2, 3]
SELECT ARRAY_REMOVE(array_col, 2)
-- [1,null]
SELECT ARRAY_REMOVE(array_col, null)
-- NULL
SELECT ARRAY_REMOVE(array_col, 2)
-- NULL
SELECT ARRAY_REMOVE(null, 2)
-- NULL
Usage Notes
If the list is NULL, this function returns NULL. If the value is NULL, this function returns NULL.