MIDDLE(value_exp)

Returns the Middle Value of the unsorted population of value_exp.

Description

This function returns the middle value of the unsorted population of n elements.

Middle will return the (n+1)/2'th value, performing integer division.

 

Example:

V1

V2

V3

V4

V5

V6

5

25

2

25

25

30

 

The above example would return 2, because it is the 3rd value in the population ((6+1)/2 = 3.5 ~=3).

 

V1

V2

V3

V4

V5

5

25

2

25

25

 

The above example would return 2, because it is the 3rd value in the population ((5+1)/2 = 3).

 

Parameters

value_exp can be an expression of any SQL data type.