Home >Database >Mysql Tutorial >mysql SIGN(x) 判断数字x是正数负数还是零

mysql SIGN(x) 判断数字x是正数负数还是零

WBOY
WBOYOriginal
2016-06-01 09:56:495269browse

mysql SIGN(x)符号函数,根据数值返回1(正数) 0(零) -1(负数).

下面用一个实例来说明SIGN()符号函数的使用方法:

<code class="language-sql">mysql> SELECT SIGN(-32); 
      -1

mysql> SELECT SIGN(0); 
      0

mysql> SELECT SIGN(234); 
      1</code>

即:如果x是正数,则返回1,如果x是负数,则返回-1,如果x是0,则返回0。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn