数据库
首页 > 数据库> > SQL17 获取当前薪水第二多的员工的emp_no以及其对应的薪水salary

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

作者:互联网

https://www.nowcoder.com/practice/8d2c290cc4e24403b98ca82ce45d04db?tpId=82&tags=&title=&difficulty=0&judgeStatus=0&rp=1

SELECT s.emp_no,s.salary
FROM salaries s
WHERE s.salary = (
    SELECT DISTINCT salary from salaries 
    order by salary DESC
    LIMIT 1,1
)
ORDER BY s.emp_no;

(这是第一次自己的做出的题目,加油)

标签:salary,no,薪水,salaries,emp,SELECT
来源: https://www.cnblogs.com/zhbeii/p/15780492.html