当前位置:网站首页>Oracle 限制时将空值排除
Oracle 限制时将空值排除
2022-08-09 07:26:00 【白露-】
1.Oracle特性
Oracle有个特性,就是在限制时,会将空值也排除在外:
例如:
select '小黑'name,'2'class from dual
union all select '小白'name,'0'class from dual
union all select '小红'name,'1'class from dual
union all select '小绿'name,'4'class from dual
union all select null name,'5' class from dual
如果排除小黑,那么会得到这样的数据:
select * from (select '小黑'name,'2'class from dual
union all select '小白'name,'0'class from dual
union all select '小红'name,'1'class from dual
union all select '小绿'name,'4'class from dual
union all select null name,'5' class from dual)where name<>'小黑'
数据库在排除小黑这条数据的同时,也将class为5的数据也排除掉了
2.解决
问题也很好解决,只需要在限制后面添加or name is null,即可:
select * from (select '小黑'name,'2'class from dual
union all select '小白'name,'0'class from dual
union all select '小红'name,'1'class from dual
union all select '小绿'name,'4'class from dual
union all select null name,'5' class from dual)where name<>'小黑' or name is null
边栏推荐
- 字节也开始缩招了...
- 日期处理,字符串日期格式转换
- P1505 [National Training Team] Tourism Tree Chain Breakdown
- car-price-deeplearning-0411
- 【机器学习】支持向量机(SVM)代码练习
- rsync:recv_generator: mkdir (in backup) failed:Permission denied (13) |failed to set times on '.'
- 图论,二叉树,dfs,bfs,dp,最短路专题
- 数据一致性架构
- 链表专项练习(四)
- 【Oracle 11g】Redhat 6.5 安装 Oracle11g
猜你喜欢
链表专项练习(三)
分布式事务产生的原因
虚拟机网卡报错:Bringing up interface eth0: Error: No suitable device found: no device found for connection
95后,刚工作2-3年就年薪50W+ ,才发现打败我们的,从来不是年龄···
定时任务组件Quartz
当酷雷曼VR直播遇上视频号,会摩擦出怎样的火花?
【报错】Root Cause com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
01 自然语言处理NLP介绍
【模板】树链剖分 P3384
找不到和chrome浏览器版本不同的chromedriver的解决方法
随机推荐
pytorch指定GPU
The maximum validity period of an SSL certificate is 13 months. Is it necessary to apply for multiple years at a time?
Codeforces Round #359 (Div. 2) C. Robbers' watch Violent Enumeration
XILINX K7 FPGA+RK3399 PCIE驱动调试
用tensorflow.keras模块化搭建神经网络模型
力扣 636. 函数的独占时间
Invoker 2019CCPC秦皇岛站I题 简单DP
codeforces Valera and Elections (这思维题是做不明白了)
力扣208,实现Trie(前缀树)
多米诺骨牌
Invoker 2019CCPC Qinhuangdao Station I Question Simple DP
SiamFC:用于目标跟踪的全卷积孪生网络 fully-convolutional siamese networks for object tracking
洛谷P1110 报表统计 multiset stl好题
2017icpc沈阳 G Infinite Fraction Path BFS+剪枝
Inception V3 Eye Closure Detection
Lottie系列四:使用建议
排序第二节——选择排序(选择排序+堆排序)(两个视频讲解)
【nuxt】服务器部署步骤
数据一致性架构
(error) NOAUTH Authentication required.