代码改变世界

SQL 查询中位数,并保留四位小数

2017-04-12 21:44  backyyan  阅读(5277)  评论(0编辑  收藏  举报

列表

代码:

select distinct round(nth_value(lat_n,(select round(count(lat_n)/2) from station))
over (order by lat_n asc
RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING),4) as median_lat
from station;