REVERSE
Descriptionβ
The REVERSE function is used to reverse the order of characters in a string or the order of elements in an array.
Syntaxβ
REVERSE( <seq> )
Parametersβ
Parameter | Description |
---|---|
<seq> | The string or array whose order needs to be reversed. |
Return Valueβ
Returns the string or array with the reversed order. Special cases:
- If any Parameter is NULL, NULL will be returned.
Examplesβ
SELECT reverse('hello');
+------------------+
| REVERSE('hello') |
+------------------+
| olleh |
+------------------+
SELECT reverse(['hello', 'world']);
+-----------------------------+
| reverse(['hello', 'world']) |
+-----------------------------+
| ["world", "hello"] |
+-----------------------------+