Home >Database >Mysql Tutorial >mysql TRUNCATE()函数使用实例

mysql TRUNCATE()函数使用实例

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

TRUNCATE(X,Y)

TRUNCATE(x,y)返回数值x保留到小数点后y位的值(与ROUND最大的区别是不会进行四舍五入),请看下面实例:

<code class="language-sql">mysql>SELECT TRUNCATE(7.536432,2);
+---------------------------------------------------------+
| TRUNCATE(7.536432,2)                                    |
+---------------------------------------------------------+
| 7.53                                                    |
+---------------------------------------------------------+
1 row in set (0.00 sec)</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