当前位置: 代码迷 >> Oracle认证考试 >> 目测这个题目也有有关问题
  详细解决方案

目测这个题目也有有关问题

热度:1061   发布时间:2016-04-24 03:51:23.0
目测这个题目也有问题
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.
Answer: C

哪个选项是正确的,如果子查询产生的一个值是null。
也就是如: cust_credit_limit  in (1,2,null) 
就如:cust_credit_limit = 1 or cust_credit_limit =2 or null
所以应该选D


------解决方案--------------------
in:如果子查询有null,会忽略null。
not in:如果子查询有null,则结果为null。

の,这题目,答案确实是D。。。
  相关解决方案