zoukankan      html  css  js  c++  java
  • SQL练习0603

     

    二、练习

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

    Select * from where deptno = 30;


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

    Select ename,mgr,deptno from ygb;


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

    Select * from ygb where comm>sal;


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

    Select * from ygb where comm>sal*0.6;

     


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

    Select * from ygb where (job = ‘经理’ and deptno = ‘10’) or (job = ‘销售员’ and deptno = ‘20’);

     

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

    Select * from ygb where (job = ‘经理’ and deptno = 10) or (job = ‘销售员’ and deptno = 20) and (job not in(‘经理’,’销售员’) and sal >= 20000);

     

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

    Select * from ygb where comm<1000;
    8. 查询名字由三个字组成的员工。

    Select * from ygb where ename like ‘___’;


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

    Select * from ygb where hiredate like ‘2000%’;

    Select * from ygb where hiredate>=’2000-01-01’ and hiredate<=’2000-12-31’;


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

    Select * from ygb order by mgr asc;


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

    Select * from ygb order by mgr desc,hiredate asc;

     

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

    Select * from ygb where ename like ‘_’;

     

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

    Select * from ygb where ename like ‘%’;

  • 相关阅读:
    集群技术
    Docker Swarm(一)
    服务器集群
    生产环境swarm集群规划和管理
    集群的分类
    Arcengine C#开发源码
    BIOS设置中开启cpu睿频功能
    aida64怎么用?aida64最详细的使用教程
    SQL Server2019最大并行度
    IIS 之 在IIS7、IIS7.5中应用程序池最优配置方案
  • 原文地址:https://www.cnblogs.com/mjwwzy/p/9132010.html
Copyright © 2011-2022 走看看