trim

description

Syntax

VARCHAR trim(VARCHAR str[, VARCHAR rhs])

When the ‘rhs’ parameter is not present, remove the continuous spaces that appear from the starting and ending of the ‘str’ parameter. Otherwise, remove ‘rhs’.

example

1. mysql> SELECT trim('   ab d   ') str;
2. +------+
3. | str  |
4. +------+
5. | ab d |
6. +------+

8. mysql> SELECT trim('ababccaab','ab') str;
9. +------+
10. | str  |
11. +------+
12. | cca  |
13. +------+

keywords

1. TRIM