images\cherry_red.png1 MySQL学习笔记
      images\cherry_blue.png1.1 LeetCode每日一题
         images\cherry_orange.png1.1.1 183. 从不订购的客户
      images\cherry_blue.png1.2 数据库特性
      images\cherry_blue.png1.3 正则表达式
         images\cherry_orange.png1.3.1 MySQL正则表达式
         images\cherry_orange.png1.3.2 Hive正则表达式
      images\cherry_blue.png1.4 MySQL基础操作语句
         images\cherry_orange.png1.4.1 增加
            images\cherry_cyan.png1.4.1.1 create
            images\cherry_cyan.png1.4.1.2 insert
         images\cherry_orange.png1.4.2 删除
            images\cherry_cyan.png1.4.2.1 drop
            images\cherry_cyan.png1.4.2.2 delete
         images\cherry_orange.png1.4.3 查询
         images\cherry_orange.png1.4.4 修改
            images\cherry_cyan.png1.4.4.1 update
            images\cherry_cyan.png1.4.4.2 alter
         images\cherry_orange.png1.4.5 基础操作命令
            images\cherry_cyan.png1.4.5.1 union
            images\cherry_cyan.png1.4.5.2 like
         images\cherry_orange.png1.4.6 复制表
         images\cherry_orange.png1.4.7 replace
      images\cherry_blue.png1.5 MySQL数据误删恢复
         images\cherry_orange.png1.5.1 docker远程连接MySQL报错
      images\cherry_blue.png1.6 MySQL主从之间的关系
         images\cherry_orange.png1.6.1 Binlog
      images\cherry_blue.png1.7 MySQL基本操作命令
         images\cherry_orange.png1.7.1 权限授予
         images\cherry_orange.png1.7.2 数据备份
         images\cherry_orange.png1.7.3 主从配置
         images\cherry_orange.png1.7.4 主从(主主)互用配置
         images\cherry_orange.png1.7.5 拉链表用途
            images\cherry_cyan.png1.7.5.1 拉链表
         images\cherry_orange.png1.7.6 字段类型转换
      images\cherry_blue.png1.8 Keepalived+MySQL 高可用架构
      images\cherry_blue.png1.9 HAproxy+MySQL 负载均衡
      images\cherry_blue.png1.10 Mycat+ MySQL 读写分离(高可用)优化
         images\cherry_orange.png1.10.1 Mycat配置文件详解
         images\cherry_orange.png1.10.2 安装配置Mycat
         images\cherry_orange.png1.10.3 MySQL分库操作
         images\cherry_orange.png1.10.4 Mycat测试实验
      images\cherry_blue.png1.11 MHA
         images\cherry_orange.png1.11.1 MHA初始化配置
      images\cherry_blue.png1.12 MySQL索引结构
      images\cherry_blue.png1.13 MySQL索引类型
      images\cherry_blue.png1.14 SQL执行计划(explain)
      images\cherry_blue.png1.15 SQL优化
      images\cherry_blue.png1.16 慢查询日志
      images\cherry_blue.png1.17 Druid监控
update table_name set 【表字段】= ... ,[] 可以存在多个字段修改where xxx=...


UPDATE替换某个字段中的某个字符

当我们需要将字段中的特定字符串批量修改为其他字符串时,可已使用以下操作:
UPDATE table_name SET field=REPLACE(field, 'old-string', 'new-string')
[WHERE Clause]实例:
以下实例将更新 runoob_id 为 3 的runoob_title 字段值的 "C++" 替换为 "Python":
UPDATE runoob_tbl SET runoob_title = REPLACE(runoob_title, 'C++', 'Python') where
runoob_id
= 3;

举例!
UPDATE persondata SET age=age*2, age=age+1;

该下面语句可能会出现错误,因此需要起别名???
delete from titles_test
where id not in (select min(id) from titles_test group by emp_no);

delete from titles_test
where id not in (select *
from(select min(id) from titles_test group by emp_no));


以上两个语句的会报错。原因是
MySQL的UPDATE或DELETE中子查询不能为同一张表,可将查询结果再次SELECT,并且需要给子查询添加别名,不然会抛出错误。
解决方式如下:

delete from titles_test
where id not in (select *
from(select min(id) from titles_test group by emp_no) as a);