Weather Observation Station 20

  • + 0 comments

    with ordered as ( select lat_n, row_number() over (order by lat_n) as row_num from station ), counts as ( select count(lat_n) as total from ordered ), median_vals as ( select o.lat_n, c.total from ordered o cross join counts c where o.row_num = floor((c.total + 1)/2) or o.row_num = ceil((c.total + 1)/2) ) select round(avg(lat_n), 4) as median from median_vals;