Oarcle 入门之where关键字

时间:2023-03-08 22:00:35

--where 关键字

--作用:过滤行  *将需要的行用where引导出来

用法:

  1.判断符号:=,!=,<>,<,>,<=,>=,any,some,all;

    例如:要求在表中sal等于1000      select * from emp where sal=1000;

        求sal大于1500且大于1800大于2000    select * from emp where sal !=any(1500,1800,2000);

    * some和any 用法一致,all表示为全部;

  2. is null,is not null

    例如:select * from empty where  comm is not null;

  3.between x and Y

  例如查询工人薪水在2000~3000之间的员工信息  select * from emp where sal between 2000 and 3000;

  4.and ,or , not

  例如: select * from emp where sal >=2000 and sal<=3000;

  5.int (list),not in(list)

  查询职务为MANAGER和ANALYST的员工信息  select  *  from where job in ('MANAGER','ANALYST');

  查询工资不为3000和5000的员工信息   select * from emp where sal not in (3000,5000);