Functions / Aggregation Functions |

Returns the median of all the values in the specified attribute, which is equivalent to sorting all the values and picking the value in the middle. If there is an even number of values, the mean of the two middle values is returned.

Median ( n )

`n` is a numeric or temporal expression.

This query returns the median of each continent's female population.

select median(pop_fem), continent from countries group by continent

See also http://en.wikipedia.org/wiki/Median.