Aggregate Function Descriptions +-------------+ With  ORDER BY , where the frame is the default of  RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW  (in both ascending and descending order): mysql>  SELECT JSON_OBJECTAGG(c, i) OVER (ORDER BY i) AS json_object FROM t; +-------------+ | json_object | +-------------+ | {"key": 3} | | {"key": 4} | | {"key": 5} | +-------------+ mysql>  SELECT JSON_OBJECTAGG(c, i) OVER (ORDER BY i DESC) AS json_object FROM t; +-------------+ | json_object | +-------------+ | {"key": 5} | | {"key": 4} | | {"key": 3} | +-------------+ mysql>  SELECT JSON_OBJECTAGG(c, i) OVER (ORDER BY i ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS json_object FROM t; +-------------+ | json_object | +-------------+ | {"key": 5} | | {"key": 5} | | {"key": 5} | +-------------+ mysql>  SELECT JSON_OBJECTAGG(c, i) OVER (ORDER BY i) AS json_object FROM t LIMIT 1; +-------------+ | json_object | +-------------+ | {"key": 3} | +-------------+ mysql>  SELECT JSON_OBJECTAGG(c, i) OVER (ORDER BY i DESC) AS json_object FROM t LIMIT 1; +-------------+ | json_object | +-------------+ | {"key": 5} | +-------------+ • MAX([DISTINCT]  expr ) [ over_clause ] With  ORDER BY  and an explicit frame of the entire partition: To return a particular key value (such as the smallest or largest), include a  LIMIT  clause in the appropriate query. For example: See Normalization, Merging, and Autowrapping of JSON Values, for additional information and examples. Returns the maximum value of  expr .  MAX()  may take a string argument; in such cases, it returns the maximum string value. See Section 8.3.1, “How MySQL Uses Indexes” . The  DISTINCT  keyword can 2402