当前位置:网站首页>4. Multi table query
4. Multi table query
2022-04-23 07:40:00 【Ah Dai cloth clothes cool】
4. Multi-table query
1. Check employee number 、 Name of employee 、 Wages 、 Name and location of Department
select empno,ename,sal,dname,loc
from emp e,dept d
where e.deptno=d.deptno
2. Check the employee's name 、 Wages 、 Entry time 、 Department number 、 Department name
select e.ename,e.sal,e.hiredate,d.deptno,d.dname
from emp e,dept d
where e.deptno=d.deptno
3. Check the employee's name 、 Employee salary 、 Leader's name 、 Leader salary
select e.ename Name of employee ,e.sal Employee salary ,m.ename Leader's name ,m.sal Leader salary
from emp e,emp m
where e.mgr=m.empno
4. Check the employee's name 、 Employee salary 、 Leader's name 、 Leader salary
select e.ename Name of employee ,e.sal Employee salary ,d.dname Department name ,m.ename Leader's name ,m.sal Leader salary
from emp e,dept d,emp m
where e.deptno=d.deptno and e.mgr=m.empno
5. Check the employee's name 、 Employee salary 、 Department name 、 Salary level
select e.ename Name of employee ,e.sal Employee salary ,d.dname Department name ,s.grade Pay scale
from emp e,dept d,salgrade s
where e.deptno=d.deptno and e.sal between s.losal and s.hisal;
6. Check the employee's name 、 Employee salary 、 Department name 、 Employee pay scale 、 Leader's name 、 Leader salary 、 Salary grade of leaders
select e.ename Name of employee ,e.sal Employee salary ,d.dname Department name ,s.grade Employee pay scale ,m.ename Leader's name ,m.sal Leader salary ,sm.grade Salary grade of leaders
from emp e,dept d,salgrade s,salgrade sm
where e.deptno=d.deptno
and e.sal between s.losal and s.hisal
and e.mgr=m.empno
and m.sal between sm.losal and sm.hisal;
版权声明
本文为[Ah Dai cloth clothes cool]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230622239440.html
边栏推荐
猜你喜欢
随机推荐
[self motivation series] what really hinders you?
LATEX公式注意事项
keytool: command not found
2.限定查询
ESP32学习-GPIO的使用与配置
P1446 [HNOI2008]Cards(Burnside定理+dp计数)
12.约束
C语言的指针符号到底靠近变量类型还是变量名?
SAP pi / PO rfc2soap publishes RFC interface as WS example
Dirichlet 前缀和(数论优化式子复杂度利器)
Nacos/sentinel网关限流和分组 (代码)
9. Common functions
NPM installation stepping pit
反思|开启B站少女心模式,探究APP换肤机制的设计与实现
P1390 公约数的和(莫比乌斯反演)
安装配置淘宝镜像npm(cnpm)
海康威视面经总结
Authorization server (simple construction of authorization server)
keytool: command not found
菜菜的刷题日记 | 蓝桥杯 — 十六进制转八进制(纯手撕版)附进制转换笔记