MySQL trim function

Rate this post

MySQL TRIM() function returns a string after removing all prefixes or suffixes from the given string.


TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM ] str)


Name Description
BOTH Indicates that prefixes from both left and right are to be removed.
LEADING Indicates that only leading prefixes are to be removed.
TRAILING Indicates that only trailing prefixes are to be removed.
remstr The string to be removed.
FROM Keyword
str The actual string from where remstr is to be removed.


mysql> SELECT TRIM(' trim '); 
| trim           | 
1 row in set (0.00 sec)

For any query or issue, feel free to discuss on

Satya Prakash

VOIP Expert: More than 8 years of experience in Asterisk Development and Call Center operation Management. Unique Combination of Skill Set as IT, Analytics and operation management.

Leave a Reply

%d bloggers like this: