Uses a non-standard Oracle function. The data in the subqueries does not have an initial order, but at Oracle you can order it to be able to apply the ROWNUM criteria later. ROWNUM is also Oracle specific.
In addition, there may be several employees with the same salary, where you choose one of them arbitrarily, and do not show them all.
(-) SQL:
select *
from emp
order by abs(sal - avg(sal) over())
fetch first row with ties;
Oracle 12c.
( Oracle 9i, 10i 11g) :
select empno, ename, sal
from
(
select empno, ename, sal, rank() over (order by diff) as rnk
from
(
select emp.*, abs(sal - avg(sal) over()) as diff
from emp
) evaluated
) ranked
where rnk = 1;