oracle5--复杂表查询.docxVIP

  • 43
  • 0
  • 约5.81千字
  • 约 6页
  • 2017-01-22 发布于重庆
  • 举报
oracle5--复杂表查询

第五章 oracle复杂表查询查询排序 order by正序排序(小-大)[默认正序]:asc倒序排序(大-小):desceg:查询出emp表中所有员工信息,按照工资顺序从低到高显示selec t * from emp order by sal [asc];eg:查询出emp表中所有员工信息,按照工资顺序从高到低显示select * from emp order by sal desc;eg:查询出emp表中所有员工的姓名和年薪(包括奖金),按照年薪从高到底排序select ename,12*(sal+nvl(comm,0)) 年薪 from emp order by 年薪 desc;eg:查询出emp表中所有员工信息,按照部门从低到高排序,再在部门内按照工资从低到高排序select * from emp order by deptno,sal;eg:查询出emp表中所有员工信息,按照部门从低到高排序,再在部门内按照工资从高到低排序select * from emp order by deptno,sal desc;分组查询分组函数Max最大,min最小,avg平均,sum求和,count数据条数eg:查询出emp表中最高工资,最低工资、平均工资select max(sal),min(sal),avg(sal) from em

您可能关注的文档

文档评论(0)

1亿VIP精品文档

相关文档