(1)mysql replace 函數php
語法:replace(object,search,replace)mysql
意思:把object中出現search的所有替換爲replacesql
案例:函數
SQL Code複製內容到剪貼板spa
update `news` set `content`=replace(`content`,' ','');//清除news表中content字段中的空格 orm
(2)mysql trim 函數rem
語法:trim([{BOTH | LEADING | TRAILING} [remstr] FROM] str)object
如下舉例說明:date
SQL Code複製內容到剪貼板語法
mysql> SELECT TRIM(' phpernote ');
-> 'phpernote'
SQL Code複製內容到剪貼板
mysql> SELECT TRIM(LEADING 'x' FROM 'xxxphpernotexxx');
-> 'phpernotexxx'
SQL Code複製內容到剪貼板
mysql> SELECT TRIM(BOTH 'x' FROM 'xxxphpernotexxx');
-> 'phpernote'
SQL Code複製內容到剪貼板
mysql> SELECT TRIM(TRAILING 'xyz' FROM 'phpernotexxyz');
-> 'phpernotex'