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

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

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 16:17:13
Original
1259 people have browsed it

本篇文章是对关于在数据库中保留小数位的问题进行了详细的分析介绍,需要的朋友参考下 在数据库中有时我们可能需要对一些数据进行处理,例如四舍五入、直接舍去后面的几位等,其实很简单,都是有现成的函数,我们只需要套用就行了: select round(10.98*10)/

本篇文章是对关于在数据库中保留小数位的问题进行了详细的分析介绍,需要的朋友参考下

 

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

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