The RTRIM() function in MySQL is used to remove any trailing spaces (blanks) from the right side of a string. It does not remove spaces from the beginning or middle of the string.
Syntax:
RTRIM(string)
- string: The string from which the trailing spaces will be removed.
Example:
SELECT RTRIM('Hello World ');
Output:
'Hello World'
In this example, RTRIM() removes the trailing spaces after "Hello World".
Notes:
- The
RTRIM()function only removes spaces, not other whitespace characters like tabs or newlines. - It can be particularly useful when cleaning up data or ensuring that strings are formatted without unnecessary spaces.
No comments:
Post a Comment