Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. SELECT ename, sal FROM EMP WHERE sal > any (SELECT sal FROM EMP WHERE deptno = '30');
  2. SELECT ename, sal FROM EMP WHERE sal > all (SELECT sal FROM EMP WHERE deptno = '30');
  3. SELECT avg(sal), deptno FROM EMP Group by deptno having avg(sal) > (SELECT avg(sal) FROM EMP where deptno = 30);
  4. SELECT JOB FROM emp group by JOB having avg(sal) >= all (select avg(sal) FROM EMP group by job);
  5.  
  6. select ename, sal from emp where sal > (
  7. select max(sal) from emp
  8. inner join dept on dept.deptno = emp.deptno
  9. where dept.dname = 'SALES'
  10. );
  11.  
  12. select ename, sal, job from emp where job = (select job from emp where empno = 7369) and sal > (select sal from emp where empno = 7876);
  13.  
  14. --select distinct dname from emp
  15. --inner join dept on emp.deptno = dept.deptno
  16. -- where job = 'CLERK';
  17. select dname from dept where deptno in (select deptno from emp where job = 'CLERK');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement