ARRAY_MEDIAN()

All functions > ARRAY > ARRAY_MEDIAN()

Returns the statistical median of numeric array elements as a DOUBLE.

Signatures

Returns: Median value

ARRAY_MEDIAN(array: ARRAY<T>) → DOUBLE
sql
ParameterTypeRequiredDescription
arrayARRAY<T>YesNumeric array

Notes

  • Ignores NULL elements
  • For an even number of values, returns the average of the two middle values
  • Returns NULL for an empty array or an array of only NULLs

See also

Examples

FeatureQL
SELECT
    f1 := ARRAY_MEDIAN(ARRAY[3, 1, 2]) -- Odd-length median
;
Result
f1 VARCHAR
2.0

Last update at: 2026/05/26 17:22:09