Mysql Rtrim Function

MySQL: RTRIM Function

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

Description

The MySQL RTRIM function removes all space characters from the right-hand side of a string.

Syntax

The syntax for the RTRIM function in MySQL is:

RTRIM( string )

Parameters or Arguments

string

The string to trim the space characters from the right-hand side.

Applies To

The RTRIM 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 RTRIM function examples and explore how to use the RTRIM function in MySQL.

For example:

mysql> SELECT RTRIM('Tech on the net    ');
Output: 'Tech on the net'

mysql> SELECT RTRIM('   Tech   on   the   net    ');
Output: '   Tech   on   the   net'

mysql> SELECT RTRIM('AODBA.com    ');
Output: 'AODBA.com'