• where 条件查询


    比较运算符

        >     <     <=     >=     <>    !=

    select   *    from   employee    where   sex='male';

    select   *   from  employee  where   id>10;

    select * from employee where salary between 10000 and 20000;

    select * from employee where salary in (10000,20000);   单独的n个值

    范围

      between  10000   and   20000;      10000到20000之间

      in  (10000,20000)    只有10000或者20000

    模糊匹配

        like    

          %  通配符  表示任意长度的任意内容

          _   通配符   一个长度的任意内容

            select * from employee where emp_name like '程__';

          select   *   from   employee  where   emp_name like 'j%';    

          select * from employee where emp_name like '%l%';     含有l

        regexp    必须是字符串

          select * from employee where emp_name regexp '^j';     以j开头的。

            ‘g$’   以g结尾的

    逻辑运算

        not

            select   *  from  employee  where   salary   not   in  (1000,20000)  and  age =18;

            select    *   from   employee    where   sex='male'  or   post='teacher';

        and

        or

        not

    查看岗位描述部位null

          不能用=     只能用  is     

              select  *   from  employee    where    post_comment    is   not   null;

  • 相关阅读:
    Lombok注解实现final属性的构造注入
    Spring事务传播行为控制
    git分支操作
    Java泛型、泛型方法详解
    规则校验功能设计思路
    Idea下将Maven项目打成公共依赖jar包
    结合Spring注册InitializingBean接口实现策略注册
    基于枚举类的策略模式实现
    python利用smtp协议发送邮件
    html常用邮箱格式总结 在页面添加邮箱
  • 原文地址:https://www.cnblogs.com/ch2020/p/12898007.html
Copyright © 2020-2023  润新知