oracle 优化or 更换in、exists、union all几个字眼,测试没有问题!
2024-10-13 21:32:57
oracle 优化or 更换in、exists、union几个字眼。测试没有问题!
根据实际情况选择相应的语句是。假设指数,or全表扫描,in 和not in 应慎用。否则会导致全表扫描。
select *
from T_Pro_Product
where bar_code = 'nnnmmm'
or name = 'nnnmmm'
or no = 'nnnmmm'; select *
from T_Pro_Product
where 'nnnmmm' in (bar_code, name, no) --忧化
select *
from T_Pro_Product t1
where exists
(select 1
from T_Pro_Product tt1
where t1.bar_code = 'nnnmmm'
union all
select 1
from T_Pro_Product tt2
where t1.no = 'nnnmmm'
union all
select 1 from T_Pro_Product tt3 where t1.name like 'n%') --忧化
select *
from T_Pro_Product t1
where t1.id in (select id
from T_Pro_Product tt1
where t1.bar_code = 'nnnmmm'
union all
select id
from T_Pro_Product tt2
where t1.no = 'nnnmmm'
union all
select id
from T_Pro_Product tt3
where t1.name = 'nnnmmm')
最新文章
- Javascript 知识点整理
- CentOS6.5安装telnet命令
- 在SSIS 2012中使用CDC(数据变更捕获)
- Win10微软官方最终正式版ISO镜像文件
- docker入门的文章
- Linux守护进程详解(init.d和xinetd) [转]
- PHP包含文件函数include、include_once、require、require_once区别总结
- Android笔记——Bitmap自动取色(纯搬运)
- Android Service即四大组件总结
- android中选择控件与选择界面自然过度效果的实现--一种新的交互设计
- Multiple
- hdu1151Air Raid
- JQuery Smart UI
- FAIR开源Detectron:整合全部顶尖目标检测算法
- Android项目实战(四十七):轮播图效果Viewpager
- Leetcode:0002(两数之和)
- python-mongodb基本操作都在这了
- mybatis JdbcTypeInterceptor - 运行时自动添加 jdbcType 属性
- 用自定义的RoundImageView来实现圆形图片(可加边框)
- CodeForces - 779D String Game 常规二分
热门文章
- PageHeap,调试Heap问题的工具
- [C++]Hello C++
- poj 3270 更换使用
- Perl语言学习笔记 9 正则表达式处理文本
- Application to find the maximum temperature in the weather dataset
- WebService 通过POST方式访问时候,因 URL 意外地以“/方法名”结束,请求格式无法识别 解决办法
- Cocos2dx项目启程二 之 封装属于我的按钮类
- CCLuaObjcBridge调Objective-C方法传索引数组报invalid key to &;#39;next&;#39;错调试
- 【LeetCode】Reorder List 解题报告
- H3C TE BGP拓扑排错报告