Let’s continue our journey in the world of string functions.
TRIM(text_input, trim_characters = ' ')
TRIM() function is extremely useful in case there’s some raw data in our data warehouse. It could happen that users left some spaces before or after their email which is a disaster for any kind of text analysis. The good news is that the
TRIM() function removes all spaces from the beginning and the end of the text input:
SELECT TRIM(' foobar ') AS trimmed_input
Note, that the
TRIM() function has the second optional argument –