it IS a correlated subquery as someone else said... Fetching only those employees who are out-earned by less than 3 people.
I avoid them as much as possible myself - I've found that other databases might not like them (interbase, for example..)
However, Oracle's optimiser is actually pretty good at this sort of thing. It seems to be very forgiving for sloppy query design....
Personally I'd do something more like: (Firebird syntax, what I use at the moment)
---
select e.ename, e.sal
from emp e
inner join emp e2 on (e2.sal > e.sal)
group by e.ename, e.sal
having (count(e2.ename) < 3)
---
... but thats just me..
That's a bad example IMO. inconsistent use of aliases, somewhat backwards use of logic (ok, that might be personal preference, but "3 > (some variable expression)" just seems weird to me)...
I found it a bit confusing to figure out what it's doing in its current format.
So it is technically valid, but it's confusingly designed and is only any good because oracle is quite good at optimising nonsense.
All just IMO of course, and my brain can sometimes be a big WTF in itself....