TRIM() function removes the leading and trailing whitespace from a specified string in the selected column.
Syntax
trim(expr)
Arguments
Argument
Description
expr
Any string expression.
Returns
Data type
Value
string
expr with leading and trailing whitespace removed.
Examples
Trim strings from a column
createtablesegments(_idid,segmentstring);insertintosegments(_id,segment)values(1,' green ')select_id,trim(segment)asTrimmedStrfromsegments;+-----+------------+|_id|TrimmedStr|+-----+------------+|1|green|+-----+------------+