mysql update
#把每个员工编号和上司的编号+1,用order by 完成 update t_emp set empno = empno + 1,mgr = mgr + 1 ORDER BY empno DESC # 把月收入前三名的工资减100 LIMIT 完成 UPDATE t_emp set sal = sal - 100 ORDER BY sal+ IFNULL(comm,0) desc limit 3 # 把 10 部门中,工龄超过20年的员工,底薪增加200 update t_emp set comm = IFNULL(comm,0) + 200 where deptno = 10 AND DATEDIFF(NOW(),hiredate)/365 > 20 #把 ALLEN 调往RESEARCH部门,职务调整为ANALYST 第一种方法 UPDATE t_emp SET job = 'ANALYST' , deptno = (SELECT deptno FROM t_dept WHERE dname = 'RESEARCH') WHERE ename = 'ALLEN' 第二种方法 #把 ALLEN 调往RESEARCH部门,职务调整为ANALYST UPDATE t_emp e join t_dept d SET e.deptno = d.deptno WHERE e.ename =