MySQL REVERSE() Function

In MySQL, the the REVERSE() function reverses the characters in a string and returns a string with the order of the characters reversed. This function is multibyte safe.

REVERSE() Syntax

Here is the syntax of MySQL REVERSE() function:

REVERSE(str)

Parameters

str
Required. String to be reversed.

Return value

The REVERSE() function returns a string with the order of the characters reversed.

The function will return NULL if any parameter is NULL.

REVERSE() Examples

Here are some examples of MySQL REVERSE() function.

SELECT
    REVERSE('ABC'),
    REVERSE('abc'),
    REVERSE('123'),
    REVERSE(NULL)\G
REVERSE('ABC'): CBA
REVERSE('abc'): cba
REVERSE('123'): 321
 REVERSE(NULL): NULL