Skip to content

TRIM

  • removing string: This parameter specifies the characters you want to remove from the string. This can include leading and trailing characters, such as spaces or specific characters enclosed within single quotes.
  • from string: This parameter specifies the string from which the REMOVING string characters are to be trimmed. It is the main string on which the TRIM operation is performed.
SELECT TRIM(' HelloWorld ') AS TrimmedString;
+---------------+
| TrimmedString |
+---------------+
| HelloWorld |
+---------------+

In the given example, the MySQL TRIM() function is used to remove the leading and trailing spaces from the string ' HelloWorld '. The result is 'HelloWorld'.