Home > Database > Mysql Tutorial > mysql数据库replace、regexp的用法_MySQL

mysql数据库replace、regexp的用法_MySQL

WBOY
Release: 2016-06-01 13:21:17
Original
1364 people have browsed it

bitsCN.com replace、regexp的用法
0 Comments | This entry was posted on Apr 08 2010
mysql replace用法
1.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')
如果存在相同的值则不会插入数据
2.replace(object,search,replace)
把object中出现search的全部替换为replace
select replace('www.163.com','w','Ww')―>WwWwWw.163.com
例:把表table中的name字段中的aa替换为bb
update table set name=replace(name,'aa','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