【ceil】函数
“select mgr, mgr/100,ceil(mgr/100) from scott.emp;
函数用法:ceil(n) ,取大于等于数值 n 的最小整数
【floor】函数
select mgr, mgr/100,floor(mgr/100) from scott.emp;
函数用法:floor(n) ,取小于等于数值 n 的最大整数。
【mod】函数
select mgr, mod(mgr,1000), mod(mgr,100), mod(mgr,10) from scott.emp;
函数用法:mod(m,n) ,取 m整除 n 后的余数
【power】函数
select mgr, power(mgr,2),power(mgr,3) from scott.emp;
函数用法:power(m,n) ,取 m的 n 次方。
【round】函数
select mgr, round(mgr/100,2),round(mgr/1000,2) from scott.emp;
函数用法:round(m,n) ,四舍五入,保留 n 位
【sign】函数
select mgr, mgr-7800,sign(mgr-7800) from scott.emp;
函数用法:sign(n) 。n>0,取 1;n=0,取 0;n<0,取-1。
【avg】函数
select avg(mgr) 平均薪水 from scott.emp;
函数用法:avg(字段名) ,求平均值。要求字段为数值型。
【count】函数
select count(*) 记录总数 from scott.emp;
“select count(distinct job ) 工作类别总数 from scott.emp;
函数用法:count(字段名)或 count(*) ,统计总数。
【min】函数
select min(sal) 最少薪水 from scott.emp;
函数用法:min(字段名) ,计算数值型字段最小数。
【max】函数
select max(sal) 最高薪水 from scott.emp;
函数用法:max(字段名) ,计算数值型字段最大数。
【sum】函数
select sum(sal) 薪水总和 from scott.emp;
函数用法:sum(字段名) ,计算数值型字段总和