MySQL TRIM() Function
THE WORLD'S LARGEST WEB DEVELOPER SITE

MySQL TRIM() Function

❮ MySQL Functions

Example

Remove leading and trailing spaces from a string:

SELECT TRIM("    SQL Tutorial    ") AS TrimmedString;
Try it Yourself »

Definition and Usage

The TRIM() function removes leading and trailing spaces from a string.

Syntax

TRIM(string)

Parameter Values

Parameter Description
string Required. The string to remove leading and trailing spaces from

Technical Details

Works in: MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0, MySQL 3.23

❮ MySQL Functions