Compatible with PostgreSQL, Hologres allows you to use standard PostgreSQL syntax for data development.
The following table describes the conditional functions supported by Hologres. The
functions supported by Hologres are only a subset of the PostgreSQL functions. For more information about how to use these functions, see Conditional Expressions in the PostgreSQL documentation.
Function | Description | Example | Result |
---|---|---|---|
case | Goes through conditions until a condition is determined to be true and then returns a corresponding value. | CASE WHEN a=1 THEN 'one' WHEN a=2 THEN 'two' ELSE 'other' END | onetwoother |
coalesce | Returns the value of the first argument in the list that is not null.
Note This function returns null only if all arguments are null.
|
COALESCE(null, 'a', 'b') | a |
nullif | Compares two arguments and returns a corresponding value. If the arguments are equal, the function returns null. If they are not equal, the first argument is returned. | nullif('a','a') | null |
greatest | Returns the largest value from a list of arguments. | greatest('a','b','c') | c |
least | Returns the smallest value from a list of arguments. | least('a','b','c') | a |