October 22, 2024
Chicago 12, Melborne City, USA
SQL

Computing 90th percentile manually vs function doesn't produce identical results, why?


So, I didn’t know originally that there was a percentile_cont function and I was trying to computer the 90th percentile of a number zeries by looking up the z-score (1.28155) and just doing the math. But I get ever more divergent numbers between my implementation and the built in function. Is this because of the inaccuracy of my z-score or do I simply misunderstand something here?

select round(((1.28155 * stddev(num)) + avg(num)),1) as my_number,
       percentile_cont(.90) within group ( order by num) as NINETIETH from (
    select level as num from dual connect by level <= 1000
)



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video