zoukankan      html  css  js  c++  java
  • MySQL like,between and以及 > < = 用法

    #模糊查 like

    select id from tbl_article where forward_title like '春%'; #从tbl_article查询出forward_title字段中首字是春的id。

    select id from tbl_article where tel like '%5634'; #从tbl_article查询出tel字段中尾字是5634的id。

    select id from tbl_article where forward_title like '%秋%'; #从tbl_article查询出forward_title字段中含有夏的id。

    select id from tbl_article where forward_title like '冬_';#从tbl_article查询出forward_title字段中含有冬某的id(_下划线占位,一个下划线代表后面有一个字)。

    select * from tbl_article where forward_title like '春__';#从tbl_article查询出forward_title字段中含有冬某某的所有信息。

    #BETWEEN and   

    select * from tbl_article where age between '20' and '50';

    select * from tbl_article where age between 20 and 50;#查找年龄在2050之间的人的所有信息

    #大于 小于 等于 不等于 and or 

    select * from tbl_article where age ='21';#查找21岁的人的所有字段的值

    select * from tbl_article where age<='50' and age>='20';                                                                                                                           

    select * from tbl_article where age<='20' or age>='50';

    select * from tbl_article where age<'40' or age>'40';#年龄不是四十岁的人的所有字段

    select * from tbl_article where age<>'40';#年龄不是四十岁的人的所有字段

    select * from tbl_article where age !='40';#年龄不是四十岁的人的所有字段

    select id,content,tel from tbl_article where forward_title ='春天' or forward_title='秋天';#查询forward_title为春天和秋天的id,content字段信息

    select * from tbl_article where age ='40' and home='信阳';#查询信阳的40岁的人

    select * from tbl_article where tbl_article<'80' and subject='语文';

  • 相关阅读:
    第二次结对编程作业
    第一次结对编程作业
    第9组 团队展示
    第一次个人编程作业
    第一次博客作业
    2016-2017-1 20155215 信息安全技术 补课上测试
    2017-2018-1 20155215 第九周 加分项 PWD命令的实现
    2017-2018-1 20155215 《信息安全系系统设计基础》实验三
    2017-2018-1 20155215 《信息安全系统设计基础》第9周学习总结
    2017-2018-1 20155215 《信息安全系统设计基础》第8周学习总结
  • 原文地址:https://www.cnblogs.com/panda-yichen/p/11752711.html
Copyright © 2011-2022 走看看