trim函数可以过滤指定的字符串:
完整格式:TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)
简化格式:TRIM([remstr FROM] str)
mysql> SELECT TRIM(' bar ');
-> 'bar'
mysql> SELECT TRIM(LEADING '?' FROM '???bar???'); --删除指定的首字符 x
-> 'bar???'
mysql> SELECT TRIM(BOTH '?' FROM '???bar???'); --删除指定的首尾字符 x
-> 'bar'
mysql> SELECT TRIM(TRAILING 'xyz' FROM 'barxxyz'); --删除指定的尾字符 x
-> 'barx'