Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 808 Bytes

File metadata and controls

28 lines (19 loc) · 808 Bytes
description
Computes the median of a dataset.

MEDIAN

Syntax

MEDIAN(order_by_expression numeric) → double precision

  • order_by_expression: The expression to sort and compute the median for.

Examples

{% code title="MEDIAN example" %}

SELECT MEDIAN(pop) 
FROM eth.recent_blocks 
-- EXPR$0
-- 2783.0

{% endcode %}

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).