use mydb4;
select
dname,
ename,
salary,
cume_dist() over(order by salary) as rn1,
cume_dist() over(partition by dname order by salary) as rn2
from employee;
#小于等于该值的,然后除以总行数
分布函数 cume_dist()
select
dname,
ename,
salary,
rank() over(partition by dname order by salary desc)as rn1,
percent_rank() over(partition by dname order by salary desc)as rn2
from employee;
percent_rank()