SIGN
Returns the sign of expr.
Syntax
sql
SIGN(expr)Arguments
expr: The value can be any numeric data type or any non-numeric data type that can be implicitly converted to a numeric data type.
Return Values
- -1 if expr is negative.
- +1 if expr is positive.
- 0 if expr is 0.
Example
sql
SELECT SIGN(7), SIGN(-39.1), SIGN(0), SIGN(NULL);+---------+-------------+---------+------------+
| SIGN(7) | SIGN(-39.1) | SIGN(0) | SIGN(NULL) |
|---------+-------------+---------+------------|
| 1 | -1 | 0 | NULL |
+---------+-------------+---------+------------+