跳到主要内容
跳到主要内容

sign

sign

description

Syntax

TINYINT sign(DOUBLE x) 返回x的符号.负数,零或正数分别对应-1,0或1.

example

mysql> select sign(3);
+-----------+
| sign(3.0) |
+-----------+
| 1 |
+-----------+
mysql> select sign(0);
+-----------+
| sign(0.0) |
+-----------+
| 0 |
mysql> select sign(-10.0);
+-------------+
| sign(-10.0) |
+-------------+
| -1 |
+-------------+
1 row in set (0.01 sec)

keywords

SIGN