Median Function

The median function returns the median of a set of values.

The syntax of the median function is


x are the values for which the median shall be calculated.
Null values are ignored.
If the number of values is zero, the function returns null.


SELECT country, median(price)
  FROM sales
  GROUP BY country;