知识点

  1. 不能使用order by同时窗函数也不能使用
  2. 去除最大薪水后的表再取最大值即为薪水第二

代码

select e.emp_no, salary, last_name, first_name 
from employees e
join salaries s
on e.emp_no = s.emp_no
where salary = (
    select max(salary)
    from salaries
    where salary<(
        select max(salary)
        from salaries
        where to_date = '9999-01-01')
    and to_date = '9999-01-01'
)