Home >Database >Mysql Tutorial >MySQL中ROUND和TRUNCATE的区别_MySQL

MySQL中ROUND和TRUNCATE的区别_MySQL

WBOY
WBOYOriginal
2016-05-30 17:11:021700browse

MySQL中ROUND和TRUNCATE的区别

1、ROUND可以进行四舍五入,按照对应的位数

2、TRUNCATE直接按照位数截取,不四舍五入

实例:

SELECT ROUND(RAND(),4),TRUNCATE(RAND(),4);

\

 

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