zoukankan      html  css  js  c++  java
  • MySQL where与like

    1、无条件查询语句(查询表中所有数据)

    select * from 表名

    2、查询某些列的数据(指定列)

    select 列名1,列名2,列名3 from 表名

     

     

    3、条件查询语句

    select 列名1,列名2 from 表名 where 条件

     

     

     

    举例条件,如下:

    符号

    释义

    示例

    >

    大于

    select  *  from 表名 where 列名1 > 某值

    >=

    大于等于

    select  列名1,列名2  from 表名 where 列名1 >= 某值

    <

    小于

    select  *  from 表名 where 列名1 < 某值

    <=

    小于等于

    select  列名1,列名2  from 表名 where 列名1 <= 某值

    =

    等于

    select  *  from 表名 where 列名1 = 某值

    !=

    不等于

    select  *  from 表名 where 列名1 != 某值

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    4、模糊查询:like

    a:占位符:%  指代一个或者多个字符

     

    b:占位符:_ 指代一个字符(一条语句中可以出现多次)

     

     

    例如:

    语句

    释义

    select 列名1,列名2 from 表名 where 列名1 like ‘%S’

    查询表中列名1以S结尾的数据

    select * from 表名 where 列名 like ‘s%’

    查询表中列名以S开头的数据

    select * from 表名 where 列名 like ‘%s_’

    查询表中列名倒数第二个字符是S的数据

    select * from 表名 where 列名 like ‘_s’

    查询表中列名正数第二个字符是S的数据

    select * from 表名 where 列名 like ‘_ _s’

    查询表中列名正数第三个字符是S的数据

     

     

     

     

     

     

     

     

     

  • 相关阅读:
    OPENGL_三角形带GL_TRIANGLE_STRIP详解
    OPENGL_单位长度对应屏幕像素
    OPENGL2_基本框架
    WINDOWS编程基础-最简单的windows程序
    着色语言(Shader Language)
    Ogre 学习记录
    Ogre RT Shader System
    Perception Neuron系统,让动作捕捉技术不再高冷
    Ogre 中基于蒙皮骨骼的OBB碰撞检测
    Ogre 绘制基本图形
  • 原文地址:https://www.cnblogs.com/fuxinxin/p/9711630.html
Copyright © 2011-2022 走看看