Which statement is true regarding the above query if one of the values generated by the subquery is NULL?

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?

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.



Leave a Reply 8

Your email address will not be published. Required fields are marked *


hwfurlan

hwfurlan

For I D is correct.

When you use IN, you’re telling SQL to take a value and compare it against every value or set of values in a list using =. If any NULL values exist, a row will not be returned–even if both values are NULL.

filavander

filavander

hwfurlan, you are right, D is correct.

JTS

JTS

right D is correct

user

user

the correct answer is D

select employee_id,last_name,commission_pct, department_id from employees
where commission_pct in (select commission_pct
from employees where department_id in (’50’,’80’))

In this query it ignores all Null values which has department_id of 50.

priest

priest

if there is one result and is null then no rows selected. if there are more results then will ignore null and generate

priest

priest

B tested – result will be no rows selected. no others result will be diplayed… in where clause you have =… so 1 result = is null => no rows selected

SELECT customer_id, cust_last_name
FROM customers
WHERE credit_limit IN
(select credit_limit
FROM customers
WHERE income_level =’255566555′);

no rows selected

priest

priest

this for 1 result !!!!

priest

priest

D is the answare !!!