Oracle简单查询练习

select * from emp;
--1. 统计出基本工资高于1500的全部雇员信息
select * from emp where sal>1500;
--2. 查询出所有基本工资小于等于2000的全部雇员信息
select * from emp where sal<=2000;
--3. 取得SMITH的详细资料
select * from emp where ename='SMITH';
--4. 查询出所有办事员(CLERK)的雇员信息
select * from emp where job='CLERK';
--5. 查询所有不是办事员的雇员信息。
select * from emp where job<>'CLERK';
--6. 查询出工资范围在1500 ~ 3000(包含1500和3000)的全部雇员信息
select * from emp where sal between 1500 and 3000;
--7. 查询职位是销售人员,并且基本工资高于1200的所有雇员信息
select * from emp where sal>1200 and job='SALESMAN';
--8. 查询出10部门中的经理或者是20部门的业务员的信息
select * from emp where deptno=10 and job='MANAGER' or deptno=20 and job='CLERK';
--9. 查询不是办事员的且基本工资大于2000的全部雇员信息
select * from emp where sal>2000 and job<>'CLERK';
--10. 使用BETWEEN…AND操作符查询出工资范围在1500 ~ 3000(包含1500和3000)的全部雇员信息
select * from emp where sal between 1500 and 3000;
--11. 查询出在1981年雇佣的全部雇员信息
select * from emp where to_char(hiredate,'yyyy')='1981';
select * from emp where hiredate between '1-1月-1981' and '31-12月-1981';
--12. 找出部门10中既不是经理也不是普通员工,而且工资大于等于2000的员工
select * from emp where deptno=10 and job<>'MANAGER' and job<>'CLERK' and sal>2000;
--13. 查询出所有领取佣金的雇员的完整信息
select * from emp where comm is not null;
--14. 查询所有不领取佣金的雇员的完整信息
select * from emp where comm is null;
--15. 列出所有的不领取奖金的雇员,而且同时要求这些雇员的基本工资大于2000的全部雇员信息
select * from emp where comm is null and sal>2000;
--16. 找出不收取佣金或收取的佣金低于100的员工。
select * from emp where comm is not null and comm<100;
--17. 找出收取佣金的员工的不同工作。
select distinct job from emp where comm is not null;
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值