欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

mysql使用replace命令批量替换_MySQL

程序员文章站 2022-04-09 20:05:30
...
bitsCN.com


mysql使用replace命令批量替换

mysql> select * from test1;

+------+---------+

| id | name |

+------+---------+

| 1 | aaaKaaa |

| 2 | bbbKbbb |

| 3 | cccKccc |

+------+---------+

3 rows in set (0.00 sec)

mysql> update test1 set name=replace(name,'K','211.99.224.138');

Query OK, 3 rows affected (0.01 sec)

Rows matched: 3 Changed: 3 Warnings: 0

mysql> select * from test1;

+------+----------------------+

| id | name |

+------+----------------------+

| 1 | aaa211.99.224.138aaa |

| 2 | bbb211.99.224.138bbb |

| 3 | ccc211.99.224.138ccc |

+------+----------------------+

3 rows in set (0.00 sec)

bitsCN.com
相关标签: mysql replace