Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
It is an aggregate function that returns the median of an expression (middle value in a sorted data set), which separates the higher half in a distribution from the lower half.
MEDIAN ( expression )
Numeric value.
INSERT INTO T4 (a,b) VALUES (1,1),(1,2),(1,3),(2,1),(2,3),(2,5);
SELECT a, MEDIAN(b) FROM T4 GROUP BY a ORDER BY a;
****
+------+-----------+
| a | MEDIAN(b) |
+------+-----------+
| 1 | 2.0000 |
| 2 | 3.0000 |
+------+-----------+