Advertisement
Guest User

rado

a guest
Jan 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. select EMPLOYEE_LEVEL,COUNT(employee_id) as Employee_Count
  2. FROM
  3. (select war.warehouse_name,
  4. upper(dep.department_name) || ' (' || dep.department_id || '-' || substr(loc.postal_code,1,3) || ')' Department,
  5.  
  6. case when round((sysdate-emp.hire_date)/365) <17 then 'Middle level'
  7. when round((sysdate-emp.hire_date)/365) between 17 and 22 then 'Senior'
  8. else 'Expert'
  9. end Employee_Level,emp.employee_id
  10.  
  11. from departments dep
  12. join oe.warehouses war
  13. on dep.location_id = war.location_id
  14. join locations loc
  15. on dep.location_id = loc.location_id
  16. join employees emp
  17. on emp.department_id = dep.department_id
  18. where loc.city != war.warehouse_name
  19. )
  20. group by EMPLOYEE_LEVEL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement