Syntax
NEG(expr)
Purpose
The NEG function performs a negation operation on the operand, which is equivalent to subtracting the operand from zero. It returns the result of the operation.
The function supports comparison operations, returning a BOOL value that is then converted to a numeric type. The result of the negation is 1 (TRUE) or 0 (FALSE).
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
