MEDIAN
Computes the median of a dataset.
Syntax
MEDIAN(order_by_expression numeric) → double precision
order_by_expression: The expression to sort and compute the median for.
Examples
SELECT MEDIAN(pop)
FROM eth.recent_blocks
-- EXPR$0
-- 2783.0
Usage Notes
This function is used with only numeric data types in Spice. NULL
values in the data set are ignored.
This function is equivalent to PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY order_by_expression)
.
Last updated
Was this helpful?