Suppose we have 3 employees in each department.we have total 3 departments . Below is the sample source table
Emp deptno salary A 10 1000 B 10
You can find 2nd highest salary something like this:
select max(a.Salary),a.Deptno from Employee a join (select MAX(salary) salary from Employee group by Deptno) b on a.Salary < b.salary group by a.Deptno
And no MAX() is not an analytic function.
Reference