…………续练习(一) SELECT e.ename , m.ename AS mgrname FROM emp e LEFT OUTER JOIN emp m – 19、查询雇佣日期早于其经理雇佣日期的员工及其经理姓名 SELECT e.ename,m.ename AS mgrname FROM emp e,emp m WHERE e.mgr=m.empno – 20、查询员工姓名及其所在的部门名称 SELECT e.ename,d.dname FROM emp e , dept d WHERE e.deptno = d.deptno; – 21、查询工作为clerk的员工姓名及其所在部门名称 SELECT e.ename,d.dname FROM emp e , dept d WHERE e.deptno = d.deptno – 22、查询各部门号及其部门中的最低工资 SELECT deptno ,MIN(sal) AS minsal FROM emp GROUP BY deptno; – 23、查询销售部sales的所有员工的姓名 SELECT ename FROM emp WHERE deptno=(SELECT deptno FROM dept WHERE – 24、查询工资水平大于平均工资的员工 SELECT * FROM emp e WHERE e.sal > (SELECT AVG(sal) FROM emp); – 25、查询与SCOTT从事相同工作的员工。 SELECT * FROM emp WHERE job = (SELECT job FROM emp WHERE ename = – 26、查询与部门编号为30的员工工资水平相同的员工信息 SELECT * FROM emp WHERE – 27、查询工资高于部门编号为30的部门所有员工工资水平的员工信息 SELECT * FROM emp WHERE sal > ALL(SELECT sal FROM emp WHERE deptno = SELECT * FROM emp WHERE sal > (SELECT MAX(sal) FROM emp WHERE – 28、查询部门号、部门名、部门所在位置及其每个部门的员工总数 SELECT d.deptno,d.dname,d.loc,COUNT(e.deptno) AS number FROM dept – 29、查询员工的姓名、工资及其所属部门 SELECT ename,dname,sal FROM emp ,dept WHERE emp.deptno = dept.deptno; – 30、查询员工的详细信息(含部门名) SELECT e.* , d.dname FROM emp e, dept d WHERE e.deptno = d.deptno; – 31、查询各工作名称以及从事此工作的最低工资 SELECT job , MIN(sal) AS minsal FROM emp GROUP BY job; – 32、计算员工的年薪并且以年薪排序 SELECT ename, sal * 12 AS yearSalary FROM emp ORDER BY yearSalary; – 33、查询工资为第4级别的员工的姓名及其工资 SELECT ename,sal FROM emp e ,salgrade s WHERE e.sal >= s.losal AND – 34、查询工资为第3等级的职员名字、工资、所属部门以及部门所在地 SELECT ename ,sal ,dname ,loc FROM emp,dept,salgrade WHERE emp.deptno – 35、查询工资等级大于smith的员工的信息 SELECT e.* FROM emp e, salgrade s WHERE s.hisal < e.sal AND s.grade =
“*”
表示难易程度
– 18、查询员工和及其所属经理的姓名 *****
ON e.mgr = m.empno; SELECT e.ename , m.ename AS mgrname FROM emp e ,
emp m WHERE e.mgr = m.empno;*****
AND e.hiredate < m.hiredate; SELECT e.ename,m.ename AS mgrname FROM
emp e INNER JOIN emp m ON e.mgr = m.empno WHERE e.hiredate <
m.hiredate;
AND e.job = ‘CLERK’;***
*****
dname=‘sales’); SELECT e.ename FROM emp e,dept d WHERE e.deptno =
d.deptno AND d.dname = ‘sales’;*****
*****
‘scott’);sal IN
(SELECT sal FROM emp WHERE deptno =
30);*****
30);
deptno = 30);*****
d,emp e WHERE d.deptno = e.deptno GROUP BY e.deptno;*****
***
*****
e.sal <= s.hisal AND s.grade = 4; SELECT emp.ename,emp.sal FROM emp
,(SELECT losal,hisal FROM salgrade WHERE grade=4) g WHERE emp.sal
BETWEEN g.losal AND g.hisal;*****
= dept.deptno AND grade = 3 AND sal >= losal AND sal < hisal;*****
(SELECT grade FROM salgrade s ,emp e WHERE s.losal < e.sal AND
s.hisal > e.sal AND e.ename = ‘smith’);
本网页所有视频内容由 imoviebox边看边下-网页视频下载, iurlBox网页地址收藏管理器 下载并得到。
ImovieBox网页视频下载器 下载地址: ImovieBox网页视频下载器-最新版本下载
本文章由: imapbox邮箱云存储,邮箱网盘,ImageBox 图片批量下载器,网页图片批量下载专家,网页图片批量下载器,获取到文章图片,imoviebox网页视频批量下载器,下载视频内容,为您提供.
阅读和此文章类似的: 全球云计算