How to find the employee with the second highest salary?

前端 未结 5 2024
生来不讨喜
生来不讨喜 2020-12-02 01:10

Is there any predefined function or method available to get the second highest salary from an employee table?

5条回答
  •  孤街浪徒
    2020-12-02 01:35

    Try this:

    SELECT * FROM employee emp WHERE 2=(SELECT COUNT(*) FROM employee WHERE
    salary >= emp.salary);
    

提交回复
热议问题