Categories
Databases MySQL

Remove leading and trailing spaces from a string in MySQL

It might be frustrating when trying to query for a record that, without knowing, has a leading or trailing space on a string column. Lets say that you have a User record with ‘ email@example.com ‘ as email attribute, one easy way to find this record is using the TRIM string function in MySQL: SELECT * FROM […]