SQL Extrema Functions
Description
Extrema functions return the maximum or minimum value after evaluating zero or more specified fields. For details, see Table 1.
Pay attention to the following points when using the extrema functions:
- If no field is set, null is returned. Fields must be convertible to common data types.
- If all fields are null, null is returned. If only some fields are null, these fields will be ignored.
- If a field contains both numbers and strings, the function compares them as strings.
- If all columns are integers, the function compares them as long values.
- If all fields are numbers and at least one is a float value, the function compares them as float values.
Syntax
SELECT GREATEST(fieldname1,fieldname2) AS the_greatest_field
Extrema Function Statements
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.