Home >Database >Mysql Tutorial >mysql如何获取一个整数的绝对值

mysql如何获取一个整数的绝对值

WBOY
WBOYOriginal
2016-06-01 09:57:001657browse

ABS()函数语法:

<code class="language-sql">ABS(X)</code>

其中参数X为需要计算的整数,函数将返回X的绝对值。

 

ABS()函数使用实例:

<code class="language-sql">mysql> SELECT ABS(-100);
        -> 100
mysql> SELECT ABS(-302);
        -> 302
mysql> SELECT ABS(2);
        -> 2</code>

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