mysql基础语句实例训练_mysql语句基本练习

select ename,job from emp where job in ('MANAGER','ANALYET','SALESMAN')

1.查询出工作岗位为MANAGER、ANALYST、SALESMAN的员工姓名、岗位名称

select *  from emp where ename like ('_A%')

2.查询emp表中,ename的值第二个字符是A的员工信息

3.select * from emp where ename like '%M%'

4.查询emp表中,员工姓名的值中包含M的员工

5.select * from emp where ename like '%A_B'

6.查询emp表中,ename的值包含A+任意一个其他字符+B的员工信息

select * from emp where comm is not null or deptno=20 order by sal desc

7.查询emp表,显示佣金不为空或者部门号为20的雇员信息,要求按照薪水降序排列

8.select * from emp where (sal+nvl(comm,0))*12>30000 and job not in 'MANAGER' or deptno not in (10,40) order by ename

9.查询emp表中年薪大于30000,工作岗位不是MANAGER且部门编号不是10和40.通过名字排列

select * from emp where lower(job)='clerk'

select * from emp where upper(job)='CLERK'

10.查询出岗位名称为CLERK的员工信息,分别使用upper()和lower()函数

select ename,to_char(hiredate,'yyyy-month-day') from emp

11.查询出员工的姓名和入职日期,年为拼写的年,月为全月名,日为全天名

select * from emp where to_char(hiredate,'yyyy')='1980'

12.查询1980入职的员工姓名

select ename,emp.deptno,dept.dname from emp,dept

where emp.deptno=10 and emp.deptno=dept.deptno

13.查询出10部门中员工的姓名、部门编号、部门名称

select job,avg(sal) from emp group by job order by avg(sal)

14.查询每个职位的平均工资,按照平均工资排序

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值