这道题是找中位数
A median is defined as a number separating the higher half of a data set from the lower half. Query the median of the Northern Latitudes (LAT_N) from STATION and round your answer to decimal places.
Input Format
The STATION table is described as follows:
where LAT_N is the northern latitude and LONG_W is the western longitude.
1. 思路一:对LAT_N进行排序,找到中间位数的排名,通过排名得出中位数
2. 思路二:中位数即比它大的数目个数和比它小的数目个数是一致的
1. 思路一解法:
mysql中没有rank的函数,但可以用自定义变量进行排序,如下:
codin