ARRAY_SORT
All functions > ARRAY > ARRAY_SORT
Returns the sorted version of an array.
Syntax
ARRAY_SORT(array)
sql
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array | ARRAYBIGINT | Yes | The input array to sort |
Returns
A new array with all elements sorted in ascending order
Notes
- Sorts elements in ascending natural order
- Numbers: numerical order (1, 2, 3...)
- Strings: lexicographical order (A, B, C...)
- Dates: chronological order (earliest to latest)
- NULL values are placed at the end of the sorted array
- Preserves duplicate values in the sorted output