GRADE, LOSAL HISAL
Fields of EMP table are as usual
I want the output like this.
GRADE LOSAL HISAL COUNT (*)
--------- --------- --------- ---------
1 700 1200 4
2 1201 1400 5
3 1401 2000 4
4 2001 3000 8
5 3001 9999 2
Select grade, losal, hisal, count (*) from EMP, salgrade
Where sal between losal and hisal
Group by grade, losal, hisal
HOW TO FIND AVGSAL OF LOSAL AND HISAL IN SALGRADE
ReplyDelete--Abhishek Rao Maidarkar
ReplyDeleteSELECT DISTINCT S.*, COUNT(*) OVER (PARTITION BY GRADE ORDER BY GRADE) FROM EMP E, SALGRADE S
WHERE E.SAL BETWEEN S.LOSAL AND S.HISAL
ORDER BY S.GRADE
--Abhishek Rao Maidarkar --For avareage salary
ReplyDeleteSELECT DISTINCT S.*, AVG(SAL) OVER (PARTITION BY GRADE ORDER BY GRADE) FROM EMP E, SALGRADE S
WHERE E.SAL BETWEEN S.LOSAL AND S.HISAL
ORDER BY S.GRADE
chutiya
ReplyDelete