zoukankan      html  css  js  c++  java
  • 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;

  • 相关阅读:
    Linux脚本文件注释
    Linux三剑客之grep命令
    Linux获取本机IP
    Linux的cut命令详解
    Linux的wc命令详解
    Linux的uniq命令详解
    Linux的sort命令详解
    shell之a+b求和脚本的三种写法
    shell的文件比较运算符和字符串比较运算符
    shell中变量$系列的含义
  • 原文地址:https://www.cnblogs.com/ch2020/p/12898007.html
Copyright © 2011-2022 走看看