oracle分析函数
select e.last_name,
e.title,
e.salary,
e.dept_id,
first_value(e.salary) over(partition by e.dept_id) first_sal,
last_value(e.salary) over(partition by e.dept_id) last_sal,
sum(e.salary) over(partition by e.dept_id) sum_sal,
avg(e.salary) over(partition by e.dept_id) avg_sal,
count(e.salary) over(partition by e.dept_id) count_num,
row_number() over(partition by e.dept_id order by e.salary) row_num
from s_emp e
order by e.dept_id asc

浙公网安备 33010602011771号