Mysql Reverse Function

MySQL: REVERSE Function

This tutorial explains how to use the MySQL REVERSE function with syntax and examples.

Description

The MySQL REVERSE function returns a string with the characters in reverse order.

Syntax

The syntax for the REVERSE function in MySQL is:

REVERSE( string )

Parameters or Arguments

string

The source string whose characters are to be reversed.

Note

  • The REVERSE function is safe to use with multi-bytes.

Applies To

The REVERSE function can be used in the following versions of MySQL:

  • MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

Example

Let's look at some MySQL REVERSE function examples and explore how to use the REVERSE function in MySQL.

For example:

mysql> SELECT REVERSE('AODBA.com');
Output: 'moc.tenehtnohcet'

mysql> SELECT REVERSE('abcde');
Output: 'edcba'

mysql> SELECT REVERSE('123');
Output: '321'

mysql> SELECT REVERSE(123);
Output: '321'