获取当前薪水第二多的员工的emp_no以及其对应的薪水salary

内联接与子查询

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

学习mysql,可以看相关的总结博客:

mysql 学习 总结