当前位置:网站首页>MySQL 如何修改SQL语句,去掉语句中的or
MySQL 如何修改SQL语句,去掉语句中的or
2022-08-03 09:38:00 【CSDN问答】
问题遇到的现象和发生背景
MySQL 如何修改SQL语句,去掉语句中的or,因为有or导致索引失效
问题相关代码,请勿粘贴截图
select bid from book a ,querybook b where ( a.bname in (b.bname) or b.bname = "" ) and
(a.bauthor in (b.bauthor) or b.bauthor = "" ) and
(a.barea in (b.barea) or b.barea = "" )
SQL作用是当查询条件为空时默认查询全部数据,不为空是则按照条件进行查询
边栏推荐
- The window of the chosen data flow
- LINGO 18.0 software installation package download and installation tutorial
- Index (3)
- System io statistics
- Mysql OCP 26题
- Oracle 迁移至Mysql
- 软体按摩机器人驱动器的设计与仿真
- ClickHouse 数据插入、更新与删除操作 SQL
- C language two-dimensional array is called with one-dimensional array
- 【LeetCode】112. Path sum
猜你喜欢
别人都不知道的“好用”网站,让你的效率飞快
ImportError: DLL load failed with error code -1073741795
AUC的两种计算方式
"Easy to use" websites that others don't know, make you more efficient
go泛型使用方法
分区分表(一)
【LeetCode】226.翻转二叉树
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements
Partition table (1)
机器学习(公式推导与代码实现)--sklearn机器学习库
随机推荐
【LeetCode】226. Flip the binary tree
SQL试题
select statement in go
好用的插件
scala reduce、reduceLeft 、reduceRight 、fold、foldLeft 、foldRight
Redis cluster concept and construction
【字节面试】word2vector输出多少个类别
MySQL8重置root账户密码图文教程
【LeetCode】112. Path sum
面试突击71:GET 和 POST 有什么区别?
013-二叉树
STP和RSTP的BPDU报文中flag位 对比+分析
Rabbit and Falcon are all covered, Go lang1.18 introductory and refined tutorial, from Bai Ding to Hongru, the whole platform (Sublime 4) Go lang development environment to build EP00
selenium IDE的3种下载安装方式
ClickHouse删除数据之delete问题详解
【LeetCode】老虎证券面试-括号嵌套且满足优先级
scala 并行集合、并行并发、线程安全问题、ThreadLocal
redis实现分布式锁的原理
MySQL_关于JSON数据的查询
What are pseudo-classes and pseudo-elements?The difference between pseudo-classes and pseudo-elements