如何计算四分位数范围

时间:2020-08-05 21:08:52

标签: sql postgresql group-by percentile

给一张表,我需要计算25%和75%四分位数的四分位数范围-它应该只是一个输出之间的差异。

注意:'gini'只是我的表rdata中的一列;我不会在这里输入数据,因为数据很长,但是我只需要弄清楚如何通过percentile_disc / cont输出差异。

select percentile_disc(0.75)-percentile_disc(0.25) within group (order by gini) from rdata;

输出错误:

LINE 1: select percentile_disc(0.75)-percentile_disc(0.25) within gr...
               ^
HINT:  No function matches the given name and argument types. You might need to add explicit type casts..

我试图转换percentile_disc :: numeric,但这也给我一个错误。

1 个答案:

答案 0 :(得分:1)

问题是必须为每个Course course = new Course(); course.setTitle("My Title"); course.setIntructor(instructor); instructor.getCourses().add(course); 指定within group

percentile_disc()