条件查询一般是

= 等于

>大于

<小于

>=大于等于

<=小于等于

<>区间

between and区间

or并且

and或者

in包含

like模糊查询

实例,现在一张mysql表,表名app01_book,详细数据如下图所示

1,查询价格为50的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price = 50;

2,查询价格大于30的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price>30;

3,查询价格大于等于30的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price>=30;

4,查询价格小于30的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price<30;

5,查询价格小于等于30的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price<=30;

6,查询价格范围在33元到51元的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price between 33 and 51;

7,查询书作者名字为wangchengyang或者为tomson的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where author_name = 'tomson' or author_name = 'wangchengyang';

8,查询书价格为50的书并且编号为666的书信息(书信息包括书名+书价格+书作者)

select name,price,author_name from app01_book where price = 50 and is_null = 666;

模糊查询

1,查询书作者姓名以z开头的作者姓名

select author_name from app01_book where author_name like 'z%';

2,查询书作者姓名以g结尾的作者姓名

select author_name from app01_book where author_name like 'g%';

3,查询书作者姓名第二位为h的作者姓名

select author_name from app01_book where author_name like '_h%'

4,查询书作者姓名第三位为m的作者姓名

select author_name from app01_book where author_name like '__m%'

最新文章

  1. Python之路Day12--mysql介绍及操作
  2. 下载imagenet2012数据集
  3. 集合框架(JCF/Java Collection Framework)
  4. hibernate 注释说明
  5. Linux内核中双向链表的经典实现
  6. iOS开发 设置状态栏样式
  7. MySQL基础之第18章 性能优化
  8. (3)TXT转为XML
  9. VC++中的DDX和DDV
  10. 关于struts2 Could not find action or result错误
  11. 深度剖析Java变量栈&对象堆
  12. 用docker搭建python项目运行环境
  13. 原生JS实现jquery的ready
  14. ssh 22端口号拒绝
  15. c# 封装 Request操作类
  16. 将javaWeb项目转maven项目
  17. nginx:负载均衡(三)分流策略
  18. 高斯求积公式 matlab
  19. 【Java】详解菜单组件
  20. OVS 内核KEY值提取及匹配流表代码分析

热门文章

  1. 项目中经常用到的sass语法汇总
  2. 在已有Win7/10系统电脑中加装Ubuntu18.04(安装双系统)
  3. Cookie在哪里看
  4. Shell 脚本如何输出帮助信息?
  5. 10分钟学会Visual Studio将自己创建的类库打包到NuGet进行引用(net,net core,C#)
  6. C# windows服务知识集锦
  7. Apache Dolphin Scheduler - Dockerfile 详解
  8. easyx小游戏
  9. Docker系列(8)- 常用其他命令(1) | 日志、元数据、进程的查看
  10. Kubernetes-Pod介绍(四)-Deployment