Declaration
NEG(expr)
Description
Complement function: performs the complement operation on the operand, that is, subtracts the operand from zero, and then returns the result to the operand.
Comparison operations are supported, with the result being a BOOL value. This value is converted to a numeric type, resulting in 1 (TRUE) or 0 (FALSE). The complement of this result is then obtained.
Examples
obclient> SELECT NEG(1), NEG(1+1), NEG(2*3), NEG(1=1), NEG(5<1);
+--------+----------+----------+----------+----------+
| NEG(1) | NEG(1+1) | NEG(2*3) | NEG(1=1) | NEG(5<1) |
+--------+----------+----------+----------+----------+
| -1 | -2 | -6 | -1 | 0 |
+--------+----------+----------+----------+----------+
1 row in set