Which two statements are true regarding subqueries? (Choose two.)
A.
The ORDER BY clause can be used in the subquery.
B.
A subquery can be used in the FROM clause of a SELECT statement.
C.
If the subquery returns NULL, the main query may still return result rows.
D.
A subquery can be placed in a WHERE clause, GROUP BY clause, or a HAVING clause.
E.
Logical operators, such as AND, OR and NOT, cannot be used in the WHERE clause
of a subquery.
ABC is correct:
select count(*) result from (select * from dual where 2 + 2 = 5 order by 1);
select nvl((select dummy from dual where 2 + 2 = 5), ‘C is correct’) result from dual;
select ‘C is correct’ result from dual where ((select dummy from dual where 2 + 2 = 5) is null);
RESULT
———-
0
RESULT
————
C is correct
RESULT
————
C is correct
If the subquery returns NULL, the main query returns ZERO rows.
This is exactly what count(*) in your example shows.
C is correct
c is incorrect
bogdan’s 3rd example is wrong because his sub-query is like (null is null)
reference:
http://www.java2s.com/Code/Oracle/Subquery/IfaninnerqueryreturnsaNULLtheouterqueryalsoreturnsNULL.htm