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

MySQL中ROUND和TRUNCATE的区别_MySQL

WBOY
Release: 2016-05-30 17:11:02
Original
1701 people have browsed it

MySQL中ROUND和TRUNCATE的区别

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

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

实例:

SELECT ROUND(RAND(),4),TRUNCATE(RAND(),4);
Copy after login

\

 

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