Home > Database > Mysql Tutorial > body text

mysql字符替换函数replace用法

WBOY
Release: 2016-06-07 17:52:13
Original
1088 people have browsed it

在mysql中replace可以替换字符,但是如果真的要更新替换内容我们还需要联合update进行操作

 代码如下 复制代码

UPDATE `addonarticle` Set `body` = REPLACE(`body`,'啊猛',小雄')

这样你字段body中的内容就给替换了

replace into

 代码如下 复制代码

replace into table (id,name) values('1','aa'),('2','bb')

此语句的作用是向表table中插入两条记录。如果主键id为1或2不存在
就相当于

 代码如下 复制代码

insert into table (id,name) values('1','aa'),('2','bb')

如果存在相同的值则不会插入数据

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template