摘要: # 删除10部门中 工龄超过20年的员工 delete from t_emp where deptno = 10 and DATEDIFF(NOW(),hiredate)/365 >= 20 #删除20部门中工资最高的员工记录 delete from t_emp where deptno = 20 阅读全文
posted @ 2019-08-08 17:32 EricBlog 阅读(171) 评论(0) 推荐(0) 编辑
摘要: #把每个员工编号和上司的编号+1,用order by 完成 update t_emp set empno = empno + 1,mgr = mgr + 1 ORDER BY empno DESC # 把月收入前三名的工资减100 LIMIT 完成 UPDATE t_emp set sal = sa 阅读全文
posted @ 2019-08-08 16:12 EricBlog 阅读(650) 评论(0) 推荐(0) 编辑
摘要: 单条插入 insert into t_dept(deptno,dname,loc)VALUES(50,'技术部','北京') 多条插入 insert into t_dept(deptno,dname,loc)VALUES(60,'后勤部','北京'),(70,'开发部','北京') 子查询插入 in 阅读全文
posted @ 2019-08-08 14:56 EricBlog 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 1 查询底薪超过公司平均底薪的员工信息? select e.empno,e.ename,e.salfrom t_emp as e join (select avg(sal) as avg from t_emp) t on e.sal > t.avg 2 统计人数 格式化时间 select count 阅读全文
posted @ 2019-08-08 13:30 EricBlog 阅读(545) 评论(0) 推荐(0) 编辑