批量搜索替换MySQL数据库中的内容

批量搜索替换MySQL数据库中的内容



语句如下:

 UPDATE table SET field = replace(field, text_needs_to_be_replaced, text_required);

例如,如果我想用下面的Mark替换所有的John,

UPDATE student SET student_name = replace(student_name, 'John', 'Mark');

语句如下 发放

以上替换是对所有的student_name 进行搜索替换,如果需要限定特定的数据,后面可以加where限定,如下:

UPDATE student SET student_name = replace(student_name, 'John', 'Mark') where id =11;



  • 发表于 2019-10-15 16:28
  • 阅读 ( 1799 )
  • 分类:软件工具

0 条评论

请先 登录 后评论
omicsgene
omicsgene

生物信息

658 篇文章

作家榜 »

  1. omicsgene 658 文章
  2. 安生水 328 文章
  3. Daitoue 167 文章
  4. 生物女学霸 120 文章
  5. 红橙子 78 文章
  6. CORNERSTONE 72 文章
  7. xun 68 文章
  8. rzx 67 文章