mysql求P30、P50、P70
mysql如何求不同的百分位数
话不多说,直接上代码,示例如下:
select
round(avg(case
when ((kk*0.3 -floor(kk*0.3))>0 and r= floor(kk*0.3)+1) then d.pp
when ((kk*0.3 -floor(kk*0.3))=0 and r between floor(kk*0.3) and floor(kk*0.3)+1) then d.pp end),2) as p30,
round(avg(case
when ((kk*0.5 -floor(kk*0.5))>0 and r= floor(kk*0.5)+1) then d.pp
when ((kk*0.5 -floor(kk*0.5))=0 and r between floor(kk*0.5) and floor(kk*0.5)+1) then d.pp end),2) as p50,
round(avg(case
when ((kk*0.7 -floor(kk*0.7))>0 and r= floor(kk*0.7)+1) then d.pp
when ((kk*0.7 -floor(kk*0.7))=0 and r between floor(kk*0.7) and floor(kk*0.7)+1) then d.pp end),2) as p70
from (
select a.pp,
row_number() over (order by a.pp) as r,
sum(1) over()
from test_table a
) d
(1)求点P(3,-2)到直线y=3/4x+1/4的距离;(2)求两条平行线L1:3x+4y-2= 数学 2020-05-12 …
求一段程序的算法,0,1,3三个数字组成一个四位或者更多位的数字串.求0,1,3三个组字组成的4位 其他 2020-05-14 …
求根公式(x+2)(x+3)=-4 求根公式(6分之一)x^2-0.5x-(3分之一)=0 求根公 数学 2020-05-16 …
如图,抛物线经过 A(-1,0)B(3,0)C(0,-3)三点 1.求抛物线的解析式和对称轴.如图 数学 2020-06-27 …
例4求函数f(x,y)=x3-y3+3x2+3y2-9x的极值.解方程组,求得x=1,-3;y=0 数学 2020-07-31 …
已知x的2次方+x-1=0,求x的3次方+2x的2次方+3的值x^3+2x^2+3=x^3+x^2- 数学 2020-11-01 …
先阅读,再解决问题,例题:若m2+2mn+2n2-6n+9=0,求m和n的值.(1)若x2+2y2- 数学 2020-11-03 …
课堂上老师出了这么一道题:(2x-3)x+3-1=0,求x的值.小明同学解答如下:∵(2x-3)x+ 数学 2020-11-28 …
1.试说明c‘=0和x’=1的几何意义.2,.求下列幂函数的导函数(1)y=x^15(2)y=x^- 数学 2021-01-22 …
RT:1,求lim(lnx/cotx)x趋于0.2,y=3根号sin(x^2),求y导.3,已知e^ 数学 2021-02-01 …