ARRAY_SORT
Description
The ARRAY_SORT
function is used to sort the input array. This function sorts the elements in the array in natural order and places all null
values at the end of the array.
Syntax
Parameter Description
array
: The input array, which can be of any type, including but not limited to integers, floats, strings, etc.
Return Result
Returns a new, sorted array. The elements in the array will be arranged in ascending order, with all null
values moved to the end of the array.
Usage Example
- Sort an array of integers:
- Sort an array containing
null
values:
- Sort the string array:
- Sorting an array of floating-point numbers:
- Sorting an array of mixed types:
Notes
- When the array contains elements of non-comparable types, it may lead to unexpected sorting results.
- If the element types in the array are inconsistent, the sorting operation may follow implicit type conversion rules, which could affect the accuracy of the sorting results.