第一种求中位数方法:

/*
第一步:添加一个正序和反序
第二步:当列表数目为奇数的时候,列表选出的情况,当列表为偶数的时候列表的情况
第三步:统筹奇数和偶数时中位数
*/
select sum(Math)/count(*) as midean
from
(
select Math, desc_Math, asc_Math
from
(
select *, row_number() over (order by Math desc) as desc_Math,
row_number() over (order by Math asc) as asc_Math
from s448
)as order_table
where asc_Math in (desc_Math, desc_Math+1, desc_Math-1)) as media_number ;

第二种求中位数方法:

/*
第一步:为数据添加索引
第二步:利用索引找出数据的中位数
*/
set @rowidx := -1; -- 声明变量
select avg(n.Math) from
(select @rowidx := @rowidx + 1 as rowidx, Math from s448 order by Math) as n
where n.rowidx in (floor(@rowidx/2), ceil(@rowidx/2));

最新文章

  1. [POJ3667]Hotel(线段树,区间合并)
  2. USB Type-C接口完美无瑕?小心这五点
  3. 1207: C.LU的困惑
  4. DP HDIJ1421 搬宿舍
  5. Android 2.3 版本中链接边框问题解决
  6. QTREE - Query on a tree
  7. 从RGB色转为灰度色算法
  8. 在windows上搭建镜像yum站的方法(附bat脚本)
  9. docker~docker-compose的使用
  10. jsp 部署
  11. app模块设计
  12. 【BZOJ2208】【JSOI2010】连通数 传递闭包
  13. APP reset.css
  14. 如何创建.gitignore文件,忽略不必要提交的文件
  15. Vue.js学习笔记之修饰符详解
  16. AlertWindowManager 弹出提示窗口使用帮助(上)
  17. Hive 常用优化参数
  18. Python笔记 #04# Methods
  19. NJCTF 2017 web pictures'wall(详解)
  20. Educational Codeforces Round 10 C. Foe Pairs 水题

热门文章

  1. Android系统编程入门系列之硬件交互——传感器
  2. difflib模块详解
  3. [cf1515G]Phoenix and Odometers
  4. 六、Java API操作zookeeper节点
  5. 7.4 k8s结合ceph rbd、cephfs实现数据的持久化和共享
  6. 洛谷 P5400 - [CTS2019]随机立方体(组合数学+二项式反演)
  7. Codeforces 611H - New Year and Forgotten Tree(二分图多重匹配)
  8. 解决Package is not available (for R version XXX)?
  9. 【机器学习与R语言】13- 如何提高模型的性能?
  10. Augustus指南(Trainning部分)