SQL Assignment by U.diwakar 4
SQL Assignment by U.diwakar 4
SQL Assignment by U.diwakar 4
SELECT JOB,COUNT(*)
FROM EMP
WHERE ENAME LIKE '%A%'
GROUP BY JOB
JOB COUNT(*)
------------- -------------
SALESMAN 3
CLERK 2
MANAGER 2
1
6.WAQTD NUMBER OF EMPLOYEES AND AVG SALARY
NEEDED TO PAY THE EMPLOYEES WHO'S SALARY IS
GREATER THAN 2000 IN EACH DEPARTMENT
SELECT DEPTNO,COUNT(*),AVG(SAL)
FROM EMP
WHERE SAL > 2000
GROUP BY DEPTNO;
SELECT DEPTNO,COUNT(*),SUM(SAL)
FROM EMP
WHERE JOB = 'SALESMAN'
GROUP BY DEPTNO;
2
DEPTNO COUNT(*) SUM(SAL)
----------- ------------ -------------
30 4 5600
SELECT JOB,COUNT(*),MAX(SAL)
FROM EMP
GROUP BY JOB;