On this page

    Categories: Percentile


    Computes the median of a dataset.


    MEDIAN(order_by_expression numeric) → double precision

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


    MEDIAN example
    SELECT MEDIAN(pop) FROM Samples."samples.dremio.com"."zips.json"
    -- EXPR$0
    -- 2783.0

    Usage Notes

    This function is used with only numeric data types in Dremio. NULL values in the data set are ignored.

    This function is equivalent to PERCENTILE_CONT(0.5) WITHIN GROUP(ORDER BY order_by_expression).