SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME LIKE ‘%S’);
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME LIKE ‘%S’);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE COMM =(SELECT MAX(COMM)
FROM EMP);
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE COMM =(SELECT MAX(COMM)
FROM EMP);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME LIKE ‘_O%’);
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME LIKE ‘_O%’);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME=’SCOTT’);
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME=’SCOTT’);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
v WHERE DNAME IN(‘OPERATIONS’,’ACCOUNTING’));
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
v WHERE DNAME IN(‘OPERATIONS’,’ACCOUNTING’));
SELECT ENAME
FROM EMP
WHERE SAL>(SELECT SAL
FROM EMP
WHERE ENAME=’MILLER’);
FROM EMP
WHERE SAL>(SELECT SAL
FROM EMP
WHERE ENAME=’MILLER’);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB=’SALESMAN’
GROUP BY DEPTNO
HAVING COUNT(*)>=3);
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB=’SALESMAN’
GROUP BY DEPTNO
HAVING COUNT(*)>=3);
SELECT ENAME
FROM EMP
WHERE EMPNO NOT IN(SELECT MGR
FROM EMP
WHERE MGR IS NOT NULL);
FROM EMP
WHERE EMPNO NOT IN(SELECT MGR
FROM EMP
WHERE MGR IS NOT NULL);
SELECT ENAME
FROM EMP
WHERE MGR=(SELECT MGR
FROM EMP
WHERE ENAME=’JONES’);
FROM EMP
WHERE MGR=(SELECT MGR
FROM EMP
WHERE ENAME=’JONES’);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME IN(‘RESEARCH’,’ACCOUNTING’) AND EMPNO IN(SELECT MGR
FROM EMP
GROUP BY MGR
HAVING COUNT(*)>=2));
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME IN(‘RESEARCH’,’ACCOUNTING’) AND EMPNO IN(SELECT MGR
FROM EMP
GROUP BY MGR
HAVING COUNT(*)>=2));
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME NOT LIKE’S%’ AND SAL BETWEEN 1500 AND 3000);
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME NOT LIKE’S%’ AND SAL BETWEEN 1500 AND 3000);
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN(SELECT MIN(SAL)
FROM EMP
WHERE SAL>2000));
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN(SELECT MIN(SAL)
FROM EMP
WHERE SAL>2000));
SELECT LOC
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE DNAME=’ACCOUNTING’);
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE DNAME=’ACCOUNTING’);
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
GROUP BY DEPTNO
HAVING COUNT(*)>4);
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
GROUP BY DEPTNO
HAVING COUNT(*)>4);
SELECT ENAME
FROM EMP
WHERE JOB NOT IN(SELECT JOB
FROM EMP
WHERE ENAME =’ALLEN’) AND SAL>(SELECT SAL
FROM EMP
WHERE ENAME=’MARTIN’));
FROM EMP
WHERE JOB NOT IN(SELECT JOB
FROM EMP
WHERE ENAME =’ALLEN’) AND SAL>(SELECT SAL
FROM EMP
WHERE ENAME=’MARTIN’));
SELECT ENAME
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE LOC IN (SELECT LOC
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE EMPNO IN (SELECT MGR
FROM EMP
WHERE ENAME='ADAMS'))));
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE LOC IN (SELECT LOC
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE EMPNO IN (SELECT MGR
FROM EMP
WHERE ENAME='ADAMS'))));
SELECT JOB
FROM EMP
WHERE MGR=(SELECT EMPNO
FROM EMP
WHERE ENAME=’JONES’);
FROM EMP
WHERE MGR=(SELECT EMPNO
FROM EMP
WHERE ENAME=’JONES’);
SELECT ENAME,HIREDATE,COMM
FROM EMP WHERE EMPNO=(SELECT MGR
FROM EMP
WHERE ENAME=’FORD’);
FROM EMP WHERE EMPNO=(SELECT MGR
FROM EMP
WHERE ENAME=’FORD’);
SELECT COUNT(*)
FROM EMP
WHERE SAL<(SELECT SAL
FROM EMP
WHERE EMPNO=(SELECT MGR
FROM EMP
WHERE ENAME=’BLAKE’));
FROM EMP
WHERE SAL<(SELECT SAL
FROM EMP
WHERE EMPNO=(SELECT MGR
FROM EMP
WHERE ENAME=’BLAKE’));
SELECT ENAME
FROM EMP
WHERE DEPTNO=(SELECT DEPTNO
FROM DEPT
WHERE LOC=’CHICAGO’) AND COMM =0;
SELECT ENAME
FROM EMP
WHERE DEPTNO=(SELECT DEPTNO
FROM DEPT
WHERE DNAME=’SALES’) AND SAL>(SELECT AVG(SAL)
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE DNAME=’SALES’))
SELECT ENAME
FROM EMP
WHERE DEPTNO=(SELECT DEPTNO
FROM DEPT
WHERE DNAME='RESEARCH') AND JOB=’MANAGER’;
SELECT DNAME
FROM DEPT
WHERE DEPTNO=(SELECT DEPTNO
FROM EMP
WHERE COMM IS NOT NULL);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN (SELECT MAX(SAL)
FROM EMP) AND MGR IS NULL);
SELECT *
FROM EMP
WHERE MGR=(SELECT EMPNO
FROM EMP
WHERE ENAME='BLAKE') AND COMM >=0;
SELECT DNAME,LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE JOB='SALESMAN')));
SELECT DNAME,LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB =’CLERK’) AND MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME =’BLAKE’) AND SAL<(SELECT SAL
FROM EMP
WHERE ENAME =’MARTIN’);
SELECT ENAME
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE JOB='PRESIDENT')) AND COMM >=0 AND SAL>(SELECT MAX(SAL)
FROM EMP
WHERE JOB='CLERK');
SELECT ENAME
FROM EMP
WHERE HIREDATE>(SELECT MIN(HIREDATE)+365*2
FROM EMP) AND SAL>(SELECT SAL
FROM EMP
WHERE ENAME='BLAKE');
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='BLAKE'));
SELECT ENAME
FROM EMP
WHERE JOB=(SELECT JOB
FROM EMP
WHERE ENAME='JONES') AND SAL<(SELECT SAL
FROM EMP
WHERE ENAME='SCOTT');
SELECT ENAME,SAL*12 ANN_SAL
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE DEPTNO IN(30,20)
GROUP BY DEPTNO
HAVING COUNT(*)>=3);
SELECT ENAME
FROM EMP
WHERE SAL < ANY (SELECT SAL
FROM EMP
WHERE JOB ='SALESMAN');
SELECT ENAME
FROM EMP
WHERE HIREDATE<(SELECT MAX(HIREDATE)
FROM EMP);
SELECT ENAME
FROM EMP
WHERE SAL > ANY(SELECT SAL
FROM EMP
WHERE JOB='MANAGER');
SELECT ENAME
FROM EMP
WHERE HIREDATE>(SELECT MIN(HIREDATE)+365*4
FROM EMP) AND SAL<(SELECT SAL
FROM EMP
WHERE ENAME='BLAKE');
SELECT *
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE LOC IN ’NEW YORK’))
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME NOT LIKE 'A%' AND SAL BETWEEN 1000 AND 3000);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='BLAKE'));
SELECT DNAME,LOC
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE EMPNO IN (SELECT MGR
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE ENAME='MARTIN')));
SELECT MGR,JOB,DEPTNO
FROM EMP
WHERE COMM IS NULL;
SELECT EMP.*,SAL*12 ANN_SALS
FROM EMP
WHERE COMM IN (SELECT MAX(COMM)
FROM EMP);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE DNAME='SALES') AND COMM >=0 AND HIREDATE<(SELECT MAX(HIREDATE)
FROM EMP);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE ENAME='WARD')));
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE SAL>(SELECT AVG(SAL)
FROM EMP
WHERE JOB='CLERK'));
SELECT EMP.*,SAL+SAL*25/100 HIKE
FROM EMP
WHERE HIREDATE IN (SELECT MAX(HIREDATE)
FROM EMP);
SELECT DEPTNO
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='SALES') AND JOB='MANAGER';
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN(SELECT MIN(SAL)
FROM EMP where MGR IS NOT NULL));
SELECT HIREDATE,JOB
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='SALES');
SELECT LOC,DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='PRESIDENT');
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN(SELECT MAX(SAL)
FROM EMP
WHERE SAL<3000));
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='ADAMS'));
SELECT *
FROM EMP
WHERE EMPNO IN(SELECT MAX(EMPNO)
FROM EMP);
SELECT ENAME
FROM EMP
WHERE SAL>(SELECT AVG(SAL)
FROM EMP
WHERE DEPTNO=30);
SELECT COUNT(*)
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='RESEARCH') AND SAL<(SELECT MAX(SAL)
FROM EMP
WHERE DEPTNO=10);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='CLERK');
SELECT DNAME
FROM DEPT
WHERE DNAME LIKE '%L%';
SELECT ENAME
FROM EMP
WHERE HIREDATE>(SELECT HIREDATE
FROM EMP
WHERE ENAME='BLAKE');
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
GROUP BY DEPTNO
HAVING COUNT(*)>=3 AND COUNT (*)>5);
SELECT LOC
FROM DEPT
WHERE DEPTNO IN (SELECT DEPTNO
FROM EMP
WHERE SAL >200 AND EMPNO IN (SELECT MGR
FROM EMP
WHERE MGR IS NOT NULL));
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME LIKE '%E%E%');
SELECT ENAME,SAL
FROM EMP
WHERE SAL > ANY (SELECT SAL
FROM EMP
WHERE JOB='ANALYST');
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE LOC='CHICAGO');
SELECT ENAME
FROM EMP
WHERE SAL IN(SELECT MIN(SAL)
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='RESEARCH'));
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='SALESMAN');
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
GROUP BY DEPTNO
HAVING COUNT(*)>=3);
SELECT ENAME
FROM EMP
WHERE DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE DNAME='RESEARCH' AND DNAME='ACCOUNTING') AND EMPNO
IN (SELECT MGR
FROM EMP
GROUP BY MGR
HAVING COUNT(*)>=2);
SELECT ENAME,JOB,LOC
FROM EMP
WHERE JOB IN ‘MANAGER’
AND DEPTNO IN (SELECT DEPTNO
FROM DEPT
WHERE LOC IN ‘CHICAGO’);
SELECT ENAME
FROM EMP
WHERE SAL<(SELECT MAX(SAL)
FROM EMP
WHERE SAL<(SELECT MAX(SAL)
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE LOC='DALLAS')));
SELECT *
FROM EMP
WHERE COMM IS NULL AND HIREDATE>'31-JUL-83';
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='SALES' AND DNAME='RESEARCH') AND EMPNO
IN(SELECT MGR
FROM EMP
GROUP BY MGR
HAVING COUNT(*)>=2);
SELECT ENAME
FROM EMP
WHERE COMM>(SELECT MAX(SAL)
FROM EMP
WHERE JOB='SALESMAN') AND MGR IN(SELECT EMPNO
FROM EMP
WHERE MGR NOT IN (SELECT EMPNO
FROM EMP
WHERE ENAME='KING'))
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE HIREDATE LIKE '%81');
SELECT MIN(SAL),DEPTNO
FROM EMP
WHERE SAL<(SELECT AVG(SAL)
FROM EMP)
GROUP BY DEPTNO;
SELECT ENAME
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='JONES');
SELECT *
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE LOC LIKE '%O%O%');
SELECT ENAME
FROM EMP
WHERE DEPTNO=10 AND SAL> ALL (SELECT SAL
FROM EMP
WHERE DEPTNO<>10);
SELECT ENAME
FROM EMP
WHERE SAL IN (SELECT MAX(SAL)
FROM EMP
GROUP BY JOB );
SELECT ENAME,EMPNO
FROM EMP
WHERE JOB='CLERK' AND SAL IN(SELECT MAX(SAL)
FROM EMP
WHERE JOB='CLERK');
SELECT HIREDATE
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
WHERE ENAME='SMITH'));
SELECT COUNT(*)
FROM EMP
WHERE JOB='SALESMAN' AND DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE LOC IN ('NEW YORK' ,'CHICAGO'));
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE HIREDATE BETWEEN '01-JAN-81' AND '31-DEC-82' AND
SAL>1800);
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL IN(SELECT MAX(SAL)
FROM EMP
WHERE MGR IS NULL));
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='ACCOUNTING') AND DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL>(SELECT AVG(SAL)
FROM EMP));
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE COMM IS NOT NULL);
SELECT ENAME
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE JOB='PRESIDENT')) AND COMM >=0 AND SAL>(SELECT MAX(SAL)
FROM EMP
WHERE JOB='CLERK');
SELECT ENAME
FROM EMP
WHERE SAL>(SELECT AVG(SAL)
FROM EMP
WHERE DEPTNO=20);
SELECT DNAME,LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='CLERK' AND MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='BLAKE' )AND SAL<(SELECT SAL
FROM EMP
WHERE ENAME='MARTIN'));
SELECT LOC,DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='MANAGER' AND SAL < (SELECT SAL
FROM EMP
WHERE JOB='CLERK'));
SELECT LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE COMM IS NOT NULL);
SELECT EMPNO,ENAME,JOB
FROM EMP
WHERE JOB LIKE '%E%'
ORDER BY EMPNO DESC;
SELECT DNAME,LOC,DEPTNO
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE EMPNO IN(SELECT MGR
FROM EMP
GROUP BY MGR
HAVING COUNT(*)>1));
SELECT AVG(SAL)
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='ACCOUNTING');
SELECT *
FROM EMP
WHERE HIREDATE LIKE '%81';
SELECT EMP.*,SAL+SAL*35/100 HIKE
FROM EMP
WHERE ENAME='SMITH' OR JOB='PRESIDENT';
SELECT COUNT(*)
FROM EMP
WHERE COMM > ( SELECT SAL
FROM EMP);
SELECT ENAME
FROM EMP
WHERE SAL/30 >1500 AND HIREDATE <'01-JAN-82';
SELECT COUNT(*)
FROM EMP
WHERE COMM >(SELECT SAL
FROM EMP);
SELECT ENAME
FROM EMP
WHERE SAL/30 >1500 AND HIREDATE <'01-JAN-82';
SELECT ENAME
FROM EMP
WHERE JOB IN(SELECT JOB
FROM EMP
WHERE ENAME='SMITH') AND DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE ENAME='JONES')) AND SAL>(SELECT SAL
FROM EMP
WHERE ENAME='TURNER');
SELECT ENAME
FROM EMP
WHERE ENAME LIKE 'S%' AND SAL>(SELECT SAL
FROM EMP
WHERE ENAME='ALLEN') AND SAL<(SELECT SAL
FROM EMP
WHERE ENAME='FORD');
SELECT JOB
FROM EMP
WHERE JOB IN ('CLERK','ANALYST') AND DEPTNO NOT IN(SELECT DEPTNO
FROM DEPT
WHERE LOC='DALLAS');
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE JOB='MANAGER'
GROUP BY JOB
HAVING COUNT(*)>=1);
SELECT MAX(SAL)
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE DNAME='SALES');
SELECT MAX(SAL)
FROM EMP
WHERE SAL<(SELECT MAX(SAL)
FROM EMP);
SELECT DNAME
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE SAL=(SELECT MAX(SAL)
FROM EMP
WHERE SAL<(SELECT MAX(SAL)
FROM EMP
WHERE SAL<(SELECT MAX(SAL)
FROM EMP))));
SELECT ENAME
FROM EMP
WHERE SAL> ALL (SELECT SAL
FROM EMP
WHERE JOB='MANAGER');
SELECT ENAME
FROM EMP
WHERE SAL>ANY(SELECT SAL
FROM EMP
WHERE JOB='MANAGER');
SELECT EMPNO,JOB,SAL
FROM EMP
WHERE JOB='ANALYST' AND SAL>ANY (SELECT SAL
FROM EMP
WHERE JOB='MANAGER');
SELECT DNAME,LOC
FROM DEPT
WHERE DEPTNO IN(SELECT DEPTNO
FROM EMP
WHERE MGR IN(SELECT EMPNO
FROM EMP
WHERE ENAME='CLARK');
SELECT ENAME
FROM EMP
WHERE DEPTNO IN(SELECT DEPTNO
FROM DEPT
WHERE LOC='DALLAS');
SELECT ENAME
FROM EMP
WHERE SAL>(SELECT AVG(SAL)
FROM EMP
WHERE DEPTNO=20);
SELECT ENAME
FROM EMP
WHERE SAL IN(SELECT MAX(SAL)
FROM EMP);
SELECT *
FROM EMP
WHERE HIREDATE IN(SELECT MIN(HIREDATE)
FROM EMP);
0 Comments