max
This function is used to return the maximum value.
Syntax
max(col)
Parameters
Parameter | Mandatory | Type | Description |
|---|---|---|---|
col | Yes | Any type except BOOLEAN | The value can be of any type except BOOLEAN. |
Return Values
The return value is of the DOUBLE type.

The return type is the same as the type of col. The return rules are as follows:
- If the value of col is NULL, the row is not involved in calculation.
- If the value of col is of the BOOLEAN type, it cannot be used for calculation.
Example Code
- Calculates the maximum inventory (items) of all offerings. An example command is as follows:
select max(items) from warehouse;
The command output is as follows:
_c0 900
- When used with group by, it returns the maximum inventory of each warehouse. An example command is as follows:
select warehouseId, max(items) from warehouse group by warehouseId;
The command output is as follows:
warehouseId _c1 city1 200 city2 300 city3 400
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.

