ARRAY_DISTINCT
All functions > ARRAY > ARRAY_DISTINCT
Returns an array with distinct elements, sorted in ascending order.
Syntax
ARRAY_DISTINCT(array)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array | ARRAYBIGINT | Yes | The input array containing possible duplicate elements |
Returns
An array with distinct elements sorted in ascending order
Notes
- Removes all duplicate elements and sorts the result
- Returns sorted distinct elements (unlike ARRAY_UNIQUE which may preserve order)
- Eliminates all duplicates using set semantics
- Handles NULL values consistently
- Empty arrays remain empty