当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
刨根问底---cocos2d源码的理解与分析
[LNOI2014]LCA——树链剖分——多点LCA深度和问题
两个线程交互打印奇偶数字
[COCI]Lampice (二分+树分治+字符串哈希)
7.子查询
Solutions to common problems in visualization (VII) solutions to drawing scale setting
2.限定查询
反思 | Android 音视频缓存机制的系统性设计
简单易懂的子集dp
积性函数前缀和——杜教筛
NPM installation stepping pit
MVCC(多版本并发控制)
莫比乌斯反演
公共依赖模块common的处理
游戏辅助脚本开发之旅
VR、AR、MR的区别与应用,以及对AR技术的一些实现原理
Mvcc (multi version concurrency control)
嵌入式相关面经(一)
Reflection on the systematic design of Android audio and video caching mechanism
5.SQL99标准:内连接和外连接