GREATEST
Description
The GREATEST function returns the greatest element that is not NULL from a set of values.
It supports all PQL types (including table columns) as input. All arguments must be of the same data type except for integers and floats which can be mixed. The data type of the result is the same as the data type of the input columns or values and float if integer and float input expressions are mixed. For example, for input of type INT, GREATEST will return the type INT. And if some inputs are of type INT and some other inputs are of type FLOAT, GREATEST will return the type FLOAT
The GREATEST function requires at least two expressions.
Unicode Support
For the STRING type, GREATEST only supports the ASCII range of characters, and not the full Unicode character set.
SYNTAX
GREATEST ( table.column1 , ... , table.columnN )
NULL handling
If all values are NULL, then GREATEST will also return NULL.
Tips
Examples
[1] GREATEST with four integer columns as arguments with some null values at different positions: | |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
[2] GREATEST with two columns and a constant as arguments: | ||||||||||||||||||||||
| ||||||||||||||||||||||
|
[3] GREATEST with four integer columns as arguments containing only null values: | ||||||||||||||||||||||||
| ||||||||||||||||||||||||
|
[4] GREATEST with four float columns as arguments with some null values at different positions: | |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
[5] GREATEST with four string columns as arguments with some null values at different positions: | |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
[6] GREATEST with four date columns as arguments with some null values at different positions: | |||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||
|
[7] If the inputs contain integer and float types the result will be of type float. | ||||||||||||||||||||||
| ||||||||||||||||||||||
|