SameTrait.sql 456 B

1234567891011121314151617
  1. USE plato;
  2. SELECT
  3. key as key,
  4. "a" || min(subkey || "q") as x1,
  5. "b" || min(subkey || "q") as x2,
  6. "c" || max(value) as x3,
  7. "d" || max(value) as x4,
  8. "1" || min(distinct subkey) as y1,
  9. "2" || min(distinct subkey) as y2,
  10. "3" || max(distinct value) as y3,
  11. "4" || max(distinct value) as y4,
  12. percentile(x, 0.5),
  13. percentile(x, 0.9)
  14. FROM (SELECT key, subkey, value, Length(key) as x from Input)
  15. GROUP BY key
  16. ORDER BY key;