美文网首页
sql取整函数

sql取整函数

作者: 飞翔的猪宝宝 | 来源:发表于2018-06-13 17:43 被阅读0次
  1. ceil (x) / ceiling(x)     向上取整
    ex: ceil(1.2) = 2
  1. floor (x)     向下取整
    ex: floor(1.2) = 1
  1. round(x) / round(x,n)     指定精度四舍五入
    ex:  round(1.5) = 2      round(1.5,3) = 1.500
  1. 指定精度进行数据截取
  • mysql:truncate(x,n)
  • oracle: trunc(x,n)
     ex: truncate(1.2,0) = 1      truncate(1.2,3) = 1.200

相关文章

网友评论

      本文标题:sql取整函数

      本文链接:https://www.haomeiwen.com/subject/bftseftx.html