zoukankan      html  css  js  c++  java
  • mysql 练习题

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

     select * from wrc where deptno;

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

    select ename,job,deptno from wrc;

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

    select * from  wrc where comm>sal;

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

     select * from wrc where comm >sal*0.6;

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

    select * from wrc where deptno = 10 and job ="经理" or job = "销售员"and deptno =20;

     

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

    select * from wrc where deptno = 10 and job ="经理" or job = "销售员"and deptno =20 or sal>20000 and job <>"经理" and job<>"销售员";

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

    select * from wrc where comm between 0 and 1000;

    或者 select * from wrc where comm<1000 and comm >=0;

     


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

    select * from wrc where ename like "___";

     

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

     

     

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


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

    select * from wrc order by empno desc;

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

     select * from wrc order by sal desc,hiredate asc;

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

    select * from wrc where ename like "周%";

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

    select * from wrc where ename like  "张%";

    14. 查询该部门有多少个岗位,每个岗位有多少人。

    select count(job),job from wrc group by job;

    15.查询哪个岗位中人数大于3

     select count(job),job from wrc group by job having count(job)>3;

     

  • 相关阅读:
    下巴肉和脖子肉怎么减肥
    java中compareTo和compare方法之比较,集合中对象的比较
    easyui中combotree只能选子选项,父级不被选中
    java线程总结(2/5)
    流行的框架与新技术
    Spring官网改版后下载
    prepareStatement与Statement的区别
    jQuery li click失效问题
    Flask 启动报错 error: [Errno 10053]
    [linux]CentOS 7 下安装 RabbitMQ
  • 原文地址:https://www.cnblogs.com/wangrongchen/p/8992369.html
Copyright © 2011-2022 走看看