O'Reilly logo
  • Jonathan Jacobson thinks this is interesting:

select outer.employee_id, outer.last_name, outer.salary, outer.department_id
  from employees outer,
         (select department_id, avg(salary) avg_sal
            from employees
           group by department_id) inner
 where outer.department_id = inner.department_id

From

Cover of Pro Oracle SQL, Second Edition

Note

Missing filter?
outer.salary > inner.avg_sal