单行函数 随机数

select  
sal as '原始数据',
round(sal) as '四舍五入后的数据' ,
round(sal,1) as '四舍五入1个小数点后的数据',
round(sal,-1) as '四舍五入-1个小数点后的数据'

from
emp;

 

# 生成100以内额随机整数
select  
   round(rand()*100)
from
    emp;

 

 

 

posted @ 2023-10-17 19:54  胖豆芽  阅读(1)  评论(0编辑  收藏  举报