TRIM() in MySQL — How It Works

What the MySQL TRIM() function does, with an example.

Published October 18, 2026

TRIM() removes leading and trailing whitespace (or a specified character) from a string.

Key points

  • Part of standard SQL functions available in MySQL for working with text/strings

Example

SELECT TRIM('  hello  ');  -- 'hello'
More SQL articles