correlated subquries
There is the subquery mentioned in the book but no alternate solution . can someone point out an alternate solution for this?
the following query list all employees whose salary is less than the average salary of their department.
select p.last_name, p.department_id from employees p
where p.salary < ( select avg(s.salary) from employees s
where s.department_id=p.department_id)
/