SELECT SUM(SAL),JOB
FROM EMP
GROUP BY JOB;
SELECT HIREDATE
FROM EMP
GROUP BY HIREDATE
HAVING COUNT(*)>=3;
SELECT DEPTNO,SUM(SAL)
FROM EMP
WHERE SAL>9000
GROUP BY DEPTNO
HAVING COUNT(*)>2;
SELECT COUNT(*),AVG(SAL)
FROM EMP
WHERE SAL<COMM
GROUP BY DEPTNO;
SELECT COUNT(*),SAL
FROM EMP
GROUP BY SAL
HAVING COUNT(*)>=1;
SELECT ENAME,COUNT(*)
FROM EMP
GROUP BY ENAME
HAVING COUNT(*)>1;
SELECT DEPTNO,AVG(SAL)
FROM EMP
WHERE SAL BETWEEN 2500 AND 3000
GROUP BY DEPTNO;
SELECT COUNT(*),DEPTNO
FROM EMP
WHERE JOB IN('MANAGER','ANALYST') AND SAL*12 LIKE '%0'
GROUP BY DEPTNO;
SELECT COUNT(JOB),DEPTNO
FROM EMP
WHERE JOB='CLERK'
GROUP BY DEPTNO;
SELECT MAX(SAL),DEPTNO
FROM EMP
WHERE JOB='MANAGER'
GROUP BY DEPTNO;
SELECT COUNT(SAL),SAL
FROM EMP
GROUP BY SAL
HAVING COUNT(*)>1;
SELECT DEPTNO,COUNT(*)
FROM EMP
WHERE DEPTNO<>10
GROUP BY DEPTNO;
SELECT COUNT(*),DEPTNO
FROM EMP
WHERE COMM IS NOT NULL
GROUP BY DEPTNO;
SELECT COUNT(*),DEPTNO
FROM EMP
WHERE SAL>1600 AND JOB<>'MANAGER'
GROUP BY DEPTNO;
SELECT AVG(SAL),JOB
FROM EMP
WHERE MGR IS NOT NULL
GROUP BY JOB;
SELECT COUNT(*),HIREDATE
FROM EMP
GROUP BY HIREDATE
HAVING COUNT(*)>1;
SELECT COUNT(*),DEPTNO,SAL
FROM EMP
GROUP BY DEPTNO,SAL
HAVING COUNT(SAL)>1;
SELECT MAX(SAL),JOB
FROM EMP
WHERE ENAME NOT LIKE'K%'
GROUP BY JOB;
SELECT COUNT(*)
FROM EMP
WHERE MGR=7839;
SELECT ENAME
FROM EMP
WHERE ENAME LIKE 'A%' OR ENAME LIKE 'E%' OR ENAME LIKE
'I%' OR ENAME LIKE 'O%' OR ENAME LIKE 'U%';
0 Comments