SELECT ENAME , JOB , SAL*12 ANNUAL_SAL, EMP.DEPTNO, DNAME
FROM EMP,DEPT
WHERE EMP.DEPTNO=DEPT.DEPTNO
AND SAL*12=30000 AND JOB<>’CLERK’;
SELECT E1.ENAME,E1.EMPNO,E2.ENAME,E2.EMPNO
FROM EMP E1,EMP E2
WHERE E1.MGR =E2.EMPNO;
SELECT ENAME,DNAME
FROM EMP RIGHT OUTER JOIN DEPT
ON EMP.DEPTNO=DEPT.DEPTNO
WHERE ENAME IS NULL;
SELECT DNAME,SUM(SAL)
FROM EMP E INNER JOIN DEPT D
ON E.DEPTNO=D.DEPTNO
GROUP BY DNAME;
SELECT ENAME,DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO;
SELECT LOC
FROM EMP E INNER JOIN DEPT D
ON E.DEPTNO=D.DEPTNO
WHERE COMM IS NOT NULL;
SELECT DNAME
FROM EMP E INNER JOIN DEPT D
ON E.DEPTNO=D.DEPTNO
WHERE SAL=(SELECT MIN(SAL) FROM EMP)
AND MGR IS NULL;
SELECT DNAME, LOC
FROM EMP E1 , EMP E2 , DEPT D
WHERE E1.ENAME = ‘SMITH’
AND E1.EMPNO=E2.MGR
AND E2.DEPTNO=D.DEPTNO;
SELECT DNAME,LOC
FROM EMP E1 , EMP E2 , EMP E3 , DEPT D
WHERE E1.JOB=‘SALESMAN’
AND E1.MGR=E2.EMPNO
AND E2.MGR = E3.EMPNO
AND E3.DEPTNO=D.DEPTNO;
SELECT ENAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND DNAME=’RESEARCH’ AND JOB=’MANAGER’;
SELECT COUNT(E3.EMPNO)
FROM EMP E1,EMP E2,EMP E3
WHERE E1.ENAME=‘BLAKE’
AND E1.MGR = E2.EMPNO
AND E3.SAL < E2.SAL ;
SELECT DNAME,LOC
FROM EMP E1 , EMP E2 , DEPT D
WHERE E1.ENAME= ‘BLAKE’
AND E1.EMPNO=E2.MGR
AND E2.JOB=‘ANALYST’
AND E2.DEPTNO=D.DEPTNO;
SELECT ENAME,HIREDATE,COMM
FROM EMP E1,EMP E2
WHERE E1.MGR=E2.EMPNO
AND E1.ENAME=’FORD’;
SELECT ENAME,DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND SAL<(SELECT AVG(SAL) FROM EMP WHERE DEPTNO=30);
SELECT E2.ENAME,DNAME,LOC
FROM EMP E1 ,DEPT D,EMP E2
WHERE E2.DEPTNO=D.DEPTNO
AND E1.EMPNO=E2.MGR
AND E1.ENAME=’JONES’;
SELECT ENAME,DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO AND E.ENAME LIKE ‘S%’;
SELECT DNAME
FROM EMP RIGHT OUTER JOIN DEPT
ON EMP.DEPTNO=DEPT.DEPTNO
WHERE ENAME IS NULL;
SELECT DNAME
FROM EMP ,DEPT
WHERE EMP.DEPTNO(+)=DEPT.DEPTNO
AND ENAME IS NULL ;
SELECT E1. ENAME,E2.ENAME,E1.COMM,E2.COMM
FROM EMP E1,EMP E2
WHERE E1.COMM=E2.COMM
AND E1.EMPNO<>E2.EMPNO;
SELECT DNAME
FROM EMP E FULL OUTER JOIN DEPT D
ON E.DEPTNO=D.DEPTNO
WHERE ENAME IS NULL;
SELECT ENAME,JOB,DNAME,LOC
FROM EMP E ,DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND JOB=’MANAGER’
AND LOC=’CHICAGO’;
SELECT DNAME
FROM EMP E,DEPT D
WHERE E.DEPTNO=D.DEPTNO
AND HIREDATE BETWEEN ’01-JAN-81’ AND ’31-DEC-82’
AND SAL>1800;
SELECT MIN(E1.SAL)
FROM EMP E1 , EMP E2
WHERE E1.SAL > E2.SAL ;
SELECT ENAME
FROM EMP
WHERE SAL*12>1500
AND HIREDATE <’01-JAN-82’;
SELECT DISTINCT DNAME,LOC,D.DEPTNO
FROM EMP E1 ,DEPT D,EMP E2
WHERE E1.DEPTNO=D.DEPTNO
AND E1.MGR=E2.MGR
AND E1.EMPNO<>E2.EMPNO;
SELECT E1.ENAME,E2.ENAME
FROM EMP E1,EMP E2
WHERE E1.MGR=E2.EMPNO;
SELECT E1.ENAME,D.DNAME
FROM EMP E1,DEPT D
WHERE E1.DEPTNO=D.DEPTNO
AND E1.ENAME LIKE ‘S%’;
SELECT E1.ENAME
FROM EMP E1,EMP E2
WHERE E1.SAL=E2.SAL
AND E1.EMPNO!=E2.EMPNO;
0 Comments