ARRAY_EXCEPT

functionsupportedCore SQL functions

docs.snowflake.com ↗

Semi-structured and structured data functions

Returns a new ARRAY that contains the elements from one input ARRAY that are not in another input ARRAY. The function is NULL-safe, meaning it treats NULLs as known values for comparing equality.

Syntax

ARRAY_EXCEPT( <source_array> , <array_of_elements_to_exclude> )

Parameters

NameRequiredDescription
source_arrayrequiredAn array that contains elements to be included in the new ARRAY.
array_of_elements_to_excluderequiredAn array that contains elements to be excluded from the new ARRAY.

Returns

This function returns an ARRAY that contains the elements from source_array that are not in array_of_elements_to_exclude. If no elements remain after excluding the elements in array_of_elements_to_exclude from source_array, the function returns an empty ARRAY. If one or both arguments are NULL, the function returns NULL. The order of the values within the returned array is unspecified.

Usage notes

See also

Referenced by