Solved programming problem

Group employees based on the first 3 digit of their phone number. Avoid employees from department no 10 or 20 or 60 and also avoid those groups where total salaries of employees is less than 50000.

Source code

SELECT COUNT(*) FROM employees

WHERE DEPARTMENT_ID NOT IN(10,20,60)

GROUP BY SUBSTR(PHONE_NUMBER,1,3)

HAVING SUM(SALARY)>50000;
Join the discussion

Add your comment