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

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

WBOY
Release: 2016-06-01 09:57:00
Original
1656 people have browsed it

ABS()函数语法:

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

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

 

ABS()函数使用实例:

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template