最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
mysql清除数据库中字符串空格方法
时间:2022-11-14 23:37:32 编辑:袖梨 来源:一聚教程网
(1)mysql replace 函数
语法:replace(object,search,replace)
意思:把object中出现search的全部替换为replace
案例:
| 代码如下 | 复制代码 |
|
1 update `news` set `content`=replace(`content`,' ',''); |
|
//清除news表中content字段中的空格
(2)mysql trim 函数
完整格式:TRIM([{BOTH | LEADING | TRAILING} [remstr] FROM] str)
简化格式:TRIM([remstr FROM] str)
以下举例说明:
| 代码如下 | 复制代码 |
|
1 mysql> SELECT TRIM(' phpernote '); 2 -> 'phpernote' 1 mysql> SELECT TRIM(LEADING 'x' FROM 'xxxphpernotexxx'); 2 -> 'phpernotexxx' 1 mysql> SELECT TRIM(BOTH 'x' FROM 'xxxphpernotexxx'); 2 -> 'phpernote' 1 mysql> SELECT TRIM(TRAILING 'xyz' FROM 'phpernotexxyz'); |
|
mysql中的去除左空格函数:
| 代码如下 | 复制代码 |
| LTRIM(str) Returns the string str with leading space characters removed. |
|
以下是代码片段:
| 代码如下 | 复制代码 |
|
mysql> SELECT LTRIM(' barbar'); This function is multi-byte safe. mysql中的去除右空格函数: 以下是代码片段: |
|
相关文章
- myfreemp3音乐网站最新网址链接-myfreemp3在线音乐免费地址入口分享 11-04
- myfreemp3音乐网站网址链接-myfreemp3在线音乐网站地址入口 11-04
- 非主流时尚爱情图片 11-03
- 拼多多商家登录-拼多多商家网页版登录入口 11-03
- DeepSeek-网页版官方入口 11-03
- qq邮箱网页版登录入口-qq邮箱官网直接访问地址 11-03