Solved programming problem

Show the employee name and no of employees who receives lower salary than him

Source code

SELECT e.EMPLOYEE_ID,COUNT(e2.EMPLOYEE_ID)

FROM employees AS e 

    JOIN  

    employees AS e2

    ON e.MANAGER_ID != e2.EMPLOYEE_ID

WHERE e.SALARY > e2.SALARY        

GROUP BY e.EMPLOYEE_ID;
Join the discussion

Add your comment