postgresql计算百分位点和百分位数 计算百分位点 两种方法:自行计算和使用postgresql内置函数计算 1.1. 使用(row -1 )/ (count - 1)方式,即该数所在位置(从小到大排列)/ 该列总个数 首先,使用row_num函数从小到大排列: select * from( select row_num() over(partition by id字段 order by 计算字段)rn,* from 表名); 然后,计算总数: select count(*) as