median()

Aggregate. Returns the median value of a given expression over multiple rows to identify the central tendency of the set of values.

Syntax

median ( column )

Parameter

column

Column name that accepts any datatype except binary.

Usage

The function returns the same datatype as the column.

Median is described as the numeric value separating the higher half of a sample, a population, or a probability distribution, from the lower half. The median of a finite list of numbers can be found by arranging all the observations from lowest value to highest value and identifying the middle value (the central tendency). In an even number of observations, there is no single middle value; in this case the median is commonly defined as the mean of the two middle values.

The median function behaves differently for different datatypes.

The median function could be used to find the median stock price of a group of stockcodes to display the districts where variances occur between prices with the same stock.