zoukankan      html  css  js  c++  java
  • 模糊查询

    --【1.模糊查询 like 通配符%】
    --以汤开头后面随便多少位都有可以
    select name,sex,id from hanshu where name LIKE '汤%'
    --只要有汤的都会显示出来
    select name,sex,id from hanshu where name LIKE '%汤%'

    --【2.BETWEE..AND 数字包含之间,包含起止值,必须是从小到大,例如:2-9 不可9-2】
    --查询结果是moeny2-9之间的起止值
    select * from hanshu where moeny BETWEEN 2 AND 9

    --NOT 相反
    select * from hanshu where moeny NOT BETWEEN 2 AND 9

    --相同语法大于2小于9
    select * from hanshu where moeny>=2 and moeny<=9

    --【IN】在列举值范围进行查找(可以与日期、数值、字符型一起使用)


    --查询‘汤慧’和‘刘丹’的信息
    select * from hanshu where name in ('汤慧','刘丹') --可以是字符串

    select * from hanshu where moeny in (5,6) --可以是数值

    select * from hanshu where data in ('2018-2-2','2018-6-8') --可以是日期

  • 相关阅读:
    3秒后页面跳转代码
    数据库 ""和null的在java 持久化中的区别
    去掉标签元素
    hibernate 自动封装
    hql 多对多查询
    javascript 数组
    spring mvc+mybatis整合
    collection映射
    mybatis中one2many
    mybatis中many2one
  • 原文地址:https://www.cnblogs.com/tangtangsimida/p/9508911.html
Copyright © 2011-2022 走看看