oracle--in与not in 语句 关于空值问题记录
来源:互联网 发布:所以国家域名后缀 编辑:程序博客网 时间:2024/05/16 19:53
drop table tmp_1;
create table tmp_1(aa varchar2(10),bb varchar2(10));
insert into tmp_1 (bb) values('1');
insert into tmp_1 (aa) values('1');
insert into tmp_1 (aa) values('2');
insert into tmp_1 (aa) values('3');
drop table tmp_2;
create table tmp_2(aa varchar2(10),bb varchar2(10));
insert into tmp_2 (bb) values('1');
insert into tmp_2 (aa) values('1');
insert into tmp_2 (aa) values('2');
commit;
1、对于not exists查询,内表存在空值对查询结果没有影响;对于not in查询,内表存在空值将导致最终的查询结果为空。
select * from tmp_1 a where a.aa not in (select aa from tmp_2);---空查询结果
select * from tmp_1 a where a.aa not in (select aa from tmp_2 where aa is not null);---只有值3记录,空值抛弃
3、对于in查询,外表或者内表存在空值,空值均抛弃,不影响其他有值记录
一、原题
Evaluate the following SQL statement:
SQL>SELECT cust_id, cust_last_name
FROM customers
WHERE cust_credit_limit IN
(SELECT cust_credit_limit
FROM customers
WHERE cust_city = 'Singapore');
Which statement is true regarding the above query if one of the values generated by the subquery is NULL?
A. It produces an error.
B. It executes but returns no rows.
C. It generates output for NULL as well as the other values produced by the subquery.
D. It ignores the NULL value and generates output for the other values produced by the subquery.
答案:C (存在疑问)
- oracle--in与not in 语句 关于空值问题记录
- 关于Orcale中not in与空值在查询上的问题
- oracle not in 问题
- mybatis foreach in查询语句 关于逗号 空值处理问题
- hadoop-hive-关于IN与NOT IN
- 关于 Oracle in 排序问题
- Oracle SQL NULL 值对 IN/NOT IN语句的影响
- Oracle中NOT IN的问题
- oracle中not in(null)问题
- oracle中not in(null)问题
- Oracle:in/Not in操作
- 关于sqlserver 中 not in 问题
- 关于Mysql用not in 删除问题
- ORACLE IN 与NOT IN 的性能区别
- ORACLE IN 与NOT IN 的性能区别
- oracle in与exists语句的区别
- ORACLE in与exists语句的区别
- ORACLE in与exists语句的区别
- linux下编译ACE
- python watchdog监控文件系统变动
- Hadoop集群安装
- SQL:Oracle层次查询总结 connect by
- uva 10305 拓扑排序(五种方式实现,全面理解邻接表+BFS实现+DFS实现)
- oracle--in与not in 语句 关于空值问题记录
- linux下的五种模型https://www.ziwenxie.site/2017/01/02/unix-network-programming-asynchronous/?nsukey=u352Le
- MTCNN人脸及特征点检测---代码应用详解(基于ncnn架构)
- 总结:数据清洗的一些总结
- Pandas:十分钟快速浏览
- Android Context 上下文 你必须知道的一切
- Ubuntu下安装搜狗输入法及常见问题解决
- bzoj 1631: [Usaco2007 Feb]Cow Party 解题报告
- thinkphp5.0中加载类库