单行函数 随机数

发布时间 2023-10-17 19:56:10作者: 无知者无畏123
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;