练习题

二、练习

1. 查询出部门编号为30的所有员工

select * from yg where deptno='30';

2. 所有销售员的姓名、编号和部门编号。

select ename,empno,deptno from yg where job='销售员';


3. 找出奖金高于工资的员工。

 

select * from yg where comm>sal;


4. 找出奖金高于工资60%的员工。

select * from yg where comm>(0.6*sal);

5. 找出部门编号为10中所有经理,和部门编号为20中所有销售员的详细资料。

 

select * from yg where (deptno='10' and job='经理') or (deptno='20' and job='销售员');

 

6. 找出部门编号为10中所有经理,部门编号为20中所有销售员,还有即不是经理又不是销售员但其工资大或等于20000的所有员工详细资料。

 select * from yg where (deptno = 10 and job = "经理")or(deptno = 20 and job = "销售员")or(job not in("经理","销售员") and sal >= 20000);

 

7. 无奖金或奖金低于1000的员工。

select * from yg where comm<1000;

8. 查询名字由三个字组成的员工。

select * from yg where ename like '___';


9.查询2000年入职的员工。

select * from yg where hiredate like "2000%";

10. 查询所有员工详细信息,用编号升序排序

 select * from yg order by empno desc;*/

11. 查询所有员工详细信息,用工资降序排序,如果工资相同使用入职日期升序排序

 select * from yg order by sal desc; 

12. 查询姓周的两个名字的员工。

select * from yg where ename like '周_';*/ 

13. 查询所有姓张的员工。

 select * from yg where ename like '张%';

 

转载于:https://www.cnblogs.com/zhengleilei/p/9131327.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值