Table 1: EMP
Columns: EMPNO,ENAME,SAL,JOB,DEPTNO
Table 2 : SALGRADE
Columns : GRADE,HISAL,LOSAL
Given the EMPNO of an employee as input to the procedure, I'll have to get the corresponding Grade and SAL as output.
Join on the sal
being between the losal
and hisal
. Something like:
SELECT g.grade,
e.sal
FROM emp e
LEFT JOIN salgrade g
ON g.losal <= e.sal
AND g.hisal >= e.sal
WHERE e.empno = ?;