题解 | SQL201#题目改成展示涨幅次数以及对应工号
查找薪水记录超过15条的员工号emp_no以及其对应的记录次数t
https://www.nowcoder.com/practice/6d4a4cff1d58495182f536c548fee1ae
select distinct c.emp_no ,count(c.emp_no) from (select emp_no ,year(from_date) ,salary 现有工资 ,lag(salary,1)over(partition by emp_no order by from_date) 上年工资 ,(salary-lag(salary,1)over(partition by emp_no order by from_date)) 涨幅 from salaries) as c where 涨幅 >0 and 涨幅 is not null group by c.emp_no