GREATEST
Description
The GREATEST function is used to find and return the maximum value from the given list of parameters. If there are null values among the parameters, the null values will be ignored.
Parameter Description
- expr: Data of comparable types, including but not limited to the following types:
- Numeric types: float, double, decimal, tinyint, smallint, int, bigint
- String types: char, varchar, string
- Binary type
- Time types: date, timestamp
Return Result
The return type is the same as the input parameter expr type.
Usage Example
- Numeric type comparison:
- String Type Comparison:
- Time Type Comparison:
Notes
- When all parameters are null, the GREATEST function returns null.