osmc:Convenções/Coberturas municipais/Algoritmos: mudanças entre as edições

Linha 222: Linha 222:
-------
-------
     7
     7
(1 row)
-- percentil 25, 50, 75 , 90, 95, 100 :
SELECT percentile_cont(0.25) within group (order by number_cells asc) as percentile_25,
      percentile_cont(0.50) within group (order by number_cells asc) as percentile_50,
      percentile_cont(0.75) within group (order by number_cells asc) as percentile_75,
      percentile_cont(0.90) within group (order by number_cells asc) as percentile_90,
      percentile_cont(0.95) within group (order by number_cells asc) as percentile_95,
      percentile_cont(  1) within group (order by number_cells asc) as percentile_100
FROM
(
  SELECT a.*
  FROM osmc.tmp_coverage_citynew4 a
  INNER JOIN
  (
    -- seleciona cobertura com células de mais digitos
    SELECT isolabel_ext, MAX(length_cell) AS length_cell
    FROM osmc.tmp_coverage_citynew4
    WHERE number_cells < 31 -- 2 sobras
    GROUP BY isolabel_ext
  ) b
  ON a.isolabel_ext = b.isolabel_ext AND a.length_cell = b.length_cell
) c
order by 1;
percentile_25 | percentile_50 | percentile_75 | percentile_90 | percentile_95 | percentile_100
---------------+---------------+---------------+---------------+---------------+----------------
            6 |            11 |            18 |            25 |            27 |            30
(1 row)
(1 row)
</syntaxhighlight>
</syntaxhighlight>
198

edições