这是老师布置下面的练习,有的部分用一些简单的 sql 语句就能够实现,有的需要用到 Oracle 中的一些函数,所以还算是比较综合的,可以看看。我的答案不是标准答案,如果哪个地方错了,还希望读者能够指出。
1、查询部门编号是 20 的员工信息。
select * from scott.emp where deptno=20;
2、查询工作为 CLERK 的员工号、员工名和部门号。
select empno,ename,deptno from scott.emp where job='CLERK';
3、查询奖金 COMM 高于工资 SAL 的员工信息。
select * from scott.emp where comm>sal ;
4、查询奖金高于工资 20% 的员工信息。
select * from scott.emp where comm>(sal*0.2) ;
5、查询部门编号是 10 并且工作为 MANAGER 的员工和部门编号是 20 并且工作为 CLERK 的员工的信息。