Home  >  Article  >  Database  >  关于数据库中保留小数位的问题_MySQL

关于数据库中保留小数位的问题_MySQL

WBOY
WBOYOriginal
2016-06-01 13:25:161029browse

bitsCN.com

在数据库中有时我们可能需要对一些数据进行处理,例如四舍五入、直接舍去后面的几位等,其实很简单,都是有现成的函数,我们只需要套用就行了:
select round(10.98*10)/10 from dual;--四舍五入
select ceil(10.63*10)/10 from dual;--取上限值
select floor(10.68*10)/10 from dual;--取下限值

bitsCN.com
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