我偶然遇到了查询来计算SO声誉的CDF:
SELECT
Reputation,
SUM(COUNT(*)) OVER(
ORDER BY Reputation
ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS UserCount
FROM
Users
GROUP BY Reputation
ORDER BY Reputation
我制作了自己的查询,看起来像
select reputation, cume_dist() over (order by reputation)
from users
gro