MySQL TRIM() Function

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: From MySQL 4.0

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.