zoukankan      html  css  js  c++  java
  • mysql比较运算,逻辑运算,范围查询,模糊查询

    比较运算 > < =  !=  <>   <=  >= 
    逻辑运算  and  or  not
    范围查询  in  
    模糊查询  like
                                                                                                    
    select distinct age from classes;                                 将classes表格里age去重                          
    select * from classes where id <= 3;                               打印classes表格里id<=3的数据  (<>、!=)除了整形还可以用于datetime                       
    select * from classes where num is(not) null;                   打印classes表格里num栏是(否)为null       is 和 not 只能用来判断null                        
    select * from student where add_time between '2018-05-08' and '2018-05-10 09:00:00';        打印student表格里add_time栏里时间在两者之间的数据,between and相当于>=、<=可作用于时间和整形                               
    select name from student where id > 1 and id < 3;        打印student表格里id>1并<3的name栏   and or not 逻辑运算符                             
     select * from student where name like '小%';             模糊查找 like 打印student表格里姓名栏(字段)里以'小'开头的数据 
    select * from student where name like '%张%';                     
    select * from student where name like '_明';                 占位匹配  _  一个下划线代表一个字符                            
     select * from student where id (not) in (1,2,3);               打印student表格里id是(否)在(1,2,3)里的数据,是否在范围内                             
     
  • 相关阅读:
    基于php5.5使用PHPMailer-5.2发送邮件
    centos安装memcached和PHP php-pecl-memcached.x86_64
    修改覆盖springboot默认日志策略logback
    Springboot打包支持第三方jar
    Intellij IDEA 快速添加maven依赖
    Mybatis Generator生成Example类方法解释
    MyBatis generator生成的Example文件用法
    Intellij IDEA 中怎么把这个黄色的填充色取消?
    MyBatis自动生成工具去掉注释的配置
    去掉Mybatis Generator生成的example
  • 原文地址:https://www.cnblogs.com/sunzhiqi/p/10072669.html
Copyright © 2011-2022 走看看