sql自带库高级查询相关例题

孤街浪徒 提交于 2019-11-30 12:50:23
1. 查询部门 20 的员工,每个月的工资总和及平均工资。
Select depnto,sum ( sal ),avg( sal ) from emp where deptno =
20 order by deptno
2. 查询工作在 CHICAGO 的员工人数,最高工资及最低工资。
Select count(distinct ename ),max( sal ),min( sal ) from
Emp e,dept d where d.loc =('CHICAGO') and e.deptno = d.deptno
3. 查询员工表中一共有几种岗位类型。
Select deptno,sum ( sal ),avg( sal ) from emp where deptno =
20 order by deptno
Select count(distinct ename ),max( sal ),min( sal ) from
Emp e,dept d where d.loc =('CHICAGO') and e.deptno = d.deptno
Select count(distinct job) from Emp
1. 查询部门 20 的员工,每个月的工资总和及平均工资。
Select depnto,sum ( sal ),avg( sal ) from emp where deptno =
20 order by deptno
2. 查询工作在 CHICAGO 的员工人数,最高工资及最低工资。
Select count(distinct ename ),max( sal ),min( sal ) from
Emp e,dept d where d.loc =('CHICAGO') and e.deptno = d.deptno
3. 查询员工表中一共有几种岗位类型。
Select deptno,sum ( sal ),avg( sal ) from emp where deptno =
20 order by deptno
Select count(distinct ename ),max( sal ),min( sal ) from
Emp e,dept d where d.loc =('CHICAGO') and e.deptno = d.deptno
Select count(distinct job) from Emp
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!