ARRAY_SORT

All functions > ARRAY > ARRAY_SORT

Returns the sorted version of an array.

Syntax

ARRAY_SORT(array)
sql

Arguments

ParameterTypeRequiredDescription
arrayARRAYBIGINTYesThe 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

Examples

Last update at: 2025/10/13 10:23:46