RTRIM() FUNCTION in MySQL

RTRIM() FUNCTION
The MySQL RTRIM function is used to remove all space characters from the right-hand side of a string. The various versions of MySQL support the RTRIM function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

RTRIM( string )

Parameters:
string: It is used to specify the string to modify.

Example 1:

mysql> SELECT RTRIM ( 'HELLO  ' );

Output:

 'HELLO’

Explanation:
All the space characters are removed from the right-hand side of the string.

Example 2:

mysql> SELECT RTRIM ( '  HELLO  ' );

Output:

 '  HELLO’

Explanation:
All the space characters are removed from the right-hand side of the string.