MySQL RTRIM function is one of the String methods which removes or deletes empty spaces from the right side of a user-given expression. Or say, this function removes trailing spaces from a given string.
Let me show you how to write a String RTRIM Function query to remove trailing empty spaces with an example. The basic syntax of RTRIM of a string is as shown below:
RTRIM(String_Expression)
MySQL RTRIM Function Example
The string RTRIM function removes the trailing spaces or right side empty spaces from a given string and returns the remaining sentence. The following query shows multiple ways to use this one. Also, read about the MySQL REPLACE.
SELECT RTRIM('MySQL ');
SELECT RTRIM(' MySQL ');
SELECT RTRIM(' MySQL ') AS Result;

You can also achieve the same using TRIM in MySQL. This String method example shows you how to use TRIM and RTRIM to remove the rightmost empty spaces.
TIP: Please refer to the MySQL TRIM and MySQL LTRIM functions from the available MySQL String functions.
SELECT RTRIM(' Tutorial Gateway ') AS Result;
SELECT TRIM(TRAILING ' ' FROM ' Tutorial Gateway ') AS Result;
SELECT RTRIM('Tutorial Gateway ') AS Result;
