#8 1 select empno, ename, sal, deptno 2 from emp 3 where sal < all 4* (select Sal from emp where deptno = 30) SQL> SQL> / EMPNO ENAME SAL DEPTNO ---------- ---------- ---------- ---------- 7369 SMITH 800 20 #9 1 select deptno, min(sal) + 1000 2 from emp 3 group by deptno 4 having min(sal) + 1000 > 5 (select avg(sal) 6 from emp 7* where deptno = 30) SQL> / DEPTNO MIN(SAL)+1000 ---------- ------------- 30 1950 20 1800 10 2300 #10 SQL> select empno, mgr, deptno from emp 2 where (mgr, deptno) in 3 (select mgr, deptno from emp 4 where empno in (7900, 7902, 7934)); EMPNO MGR DEPTNO ---------- ---------- ---------- 7900 7698 30 7844 7698 30 7654 7698 30 7521 7698 30 7499 7698 30 7902 7566 20 7788 7566 20 7934 7782 10 #11 1 select empno, deptno, 2 (select dname from dept where emp.deptno = dept.deptno) 3* from emp SQL> / EMPNO DEPTNO (SELECTDNAMEFR ---------- ---------- -------------- 7369 20 RESEARCH 7499 30 SALES 7521 30 SALES 7566 20 RESEARCH 7654 30 SALES 7698 30 SALES 7782 10 ACCOUNTING 7788 20 RESEARCH 7839 10 ACCOUNTING 7844 30 SALES 7876 20 RESEARCH EMPNO DEPTNO (SELECTDNAMEFR ---------- ---------- -------------- 7900 30 SALES 7902 20 RESEARCH 7934 10 ACCOUNTING #12 1 select deptno, dname from dept 2* where exists (select empno from emp where emp.deptno = dept.deptno) SQL> / DEPTNO DNAME ---------- -------------- 10 ACCOUNTING 20 RESEARCH 30 SALES SQL>