ARRAY_DISTINCT

functionsupportedCore SQL functions

docs.snowflake.com ↗

Semi-structured and structured data functions

Returns a new ARRAY that contains only the distinct elements from the input ARRAY. The function excludes any duplicate elements that are present in the input ARRAY. The function is not guaranteed to return the elements in the ARRAY in a specific order. The function is NULL-safe, which means that it treats NULLs as known values when identifying duplicate elements.

Syntax

ARRAY_DISTINCT( <array> )

Parameters

NameRequiredDescription
arrayrequiredAn array that might contain duplicate elements to be removed.

Returns

This function returns an ARRAY that contains the elements of the input array without any duplicate elements. For example, if the value 'x' appears multiple times in the input ARRAY, only one element has the value 'x' in the returned ARRAY. If the input argument is NULL, the function returns NULL. The order of the values within the returned array is unspecified.

Usage notes