Median Function

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

The syntax of the median function is

median(x)

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.

Example

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