D/MySQL

MySQL SIGN()

yeon.Biju 2020. 3. 29. 19:52

SIGN(X)

 

Returns the sign of the argument as -1, 0, or 1, depending on whether X is negative, zero, or positive.

 

 

mysql> SELECT SIGN(-23), SIGN(0), SIGN(234) ;
+-----------+---------+-----------+
| SIGN(-23) | SIGN(0) | SIGN(234) |
+-----------+---------+-----------+
|        -1 |       0 |         1 |
+-----------+---------+-----------+
1 row in set (0.00 sec)