forked from docs/doc-exports
Reviewed-by: Pruthi, Vineet <vineet.pruthi@t-systems.com> Co-authored-by: Su, Xiaomeng <suxiaomeng1@huawei.com> Co-committed-by: Su, Xiaomeng <suxiaomeng1@huawei.com>
4.3 KiB
4.3 KiB
median
This function is used to calculate the median of input parameters.
Syntax
median(colname)
Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
colname |
Yes |
DOUBLE, DECIMAL, STRING, or BIGINT |
Name of the column to be sorted The elements in a column are of the DOUBLE type. If an element in a column is not of the DOUBLE type, the system will implicitly convert it to the DOUBLE type for calculation. |
Return Values
The return value is of the DOUBLE or DECIMAL type.
Example Code
Assume that the elements in the int_test column are 1, 2, 3, and 4 and they are of the INT type.
The value 2.5 is returned.
select median(int_test) FROM int_test;
Parent topic: Mathematical Functions