mysql增删改查——条件查询+模糊查询
2024-10-19 11:00:49
条件查询一般是
= 等于
>大于
<小于
>=大于等于
<=小于等于
<>区间
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%'
最新文章
- Python之路Day12--mysql介绍及操作
- 下载imagenet2012数据集
- 集合框架(JCF/Java Collection Framework)
- hibernate 注释说明
- Linux内核中双向链表的经典实现
- iOS开发 设置状态栏样式
- MySQL基础之第18章 性能优化
- (3)TXT转为XML
- VC++中的DDX和DDV
- 关于struts2 Could not find action or result错误
- 深度剖析Java变量栈&对象堆
- 用docker搭建python项目运行环境
- 原生JS实现jquery的ready
- ssh 22端口号拒绝
- c# 封装 Request操作类
- 将javaWeb项目转maven项目
- nginx:负载均衡(三)分流策略
- 高斯求积公式 matlab
- 【Java】详解菜单组件
- OVS 内核KEY值提取及匹配流表代码分析
热门文章
- 项目中经常用到的sass语法汇总
- 在已有Win7/10系统电脑中加装Ubuntu18.04(安装双系统)
- Cookie在哪里看
- Shell 脚本如何输出帮助信息?
- 10分钟学会Visual Studio将自己创建的类库打包到NuGet进行引用(net,net core,C#)
- C# windows服务知识集锦
- Apache Dolphin Scheduler - Dockerfile 详解
- easyx小游戏
- Docker系列(8)- 常用其他命令(1) | 日志、元数据、进程的查看
- Kubernetes-Pod介绍(四)-Deployment