RTRIM()
RTRIM(string)This function returns the given string with any trailing
spaces removed. When used with an SQL statement such as
UPDATE, rows that do not contain trailing spaces
will not be changed. This function is multibyte-safe. To trim leading
spaces, use LTRIM(). To trim both leading and
trailing spaces, use TRIM(). Here is an
example:
UPDATE students SET name_last = RTRIM(name_last);
In this example, the last names of several students have been entered inadvertently with a space at the end of the names. This SQL statement removes any trailing spaces from each name retrieved that contains trailing spaces and then writes the trimmed text over the existing data.