median_exact

Aliases: medianexact (deprecated).

median_exact(expression: numeric or duration) -> expression

median_exact(expression) computes the continuous median at p equals 0.5 using an exact order-statistic median rather than the approximate path used by median. For numeric types the implementation may widen precision compared to integer-only inputs. Duration and timestamp inputs retain their temporal type with interpolated results where needed. It is available as a grouped aggregate or inside window like other percentile-family functions.

Domain

This is an aggregate function (aggregates rows over a group in aggregate verbs).

This is a window function (calculates over a group of multiple input rows using windowing).

Categories

Examples

aggregate exact_med:median_exact(sale_amount), group_by(store_id)

Exact continuous median of sale_amount for each store rather than an approximate median.