Oracle的多行函数实例展示:

--多行函数max() min() count() sum() avg()
--查询公司 最高工资,最低工资,总工资,平均工资,员工总数
select max(sal),min(sal),sum(sal),avg(sal),count(ename) from emp;

--max min count  可以是任意的数据类型
select max(ename),min(job),count(hiredate) from emp;
--sum avg 只能是数值类型
select sum(ename),avg(hiredate) from emp;

--count(*) 是不跳过null,其他的会跳过null值计算
--count(*) 计算一张表的记录总条数
select count(*) from bonus;

select * from emp;

--处理null 并且参与avg计算
select avg(comm),avg(nvl(comm,0)) from emp;

select deptno,count(*) from emp where deptno=10;

 

相关文章:

  • 2022-01-30
  • 2021-09-14
  • 2022-01-10
  • 2021-12-14
  • 2021-11-08
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-04
  • 2021-06-07
  • 2022-12-23
  • 2021-11-27
  • 2021-04-07
相关资源
相似解决方案