Which two expressions give the same output?

Examine the data in the LIST_PRICE and MIN_PRICE columns of the PRODUCTS table:

Which two expressions give the same output? (Choose two.)

Examine the data in the LIST_PRICE and MIN_PRICE columns of the PRODUCTS table:

Which two expressions give the same output? (Choose two.)

A.
NVL(NULLIF(list_price, min_price), 0)

B.
NVL(COALESCE(list_price, min_price), 0)

C.
NVL2(COALESCE(list_price, min_price), min_price, 0)

D.
COALESCE(NVL2(list_price, list_price, min_price), 0)

Explanation:
Using the COALESCE Function
The advantage of the COALESCE function over the NVL function is that the COALESCE
function can take multiple alternate values.
If the first expression is not null, the COALESCE function returns that expression; otherwise, it
does a COALESCE of the remaining expressions.
Using the COALESCE Function
The COALESCE function returns the first non-null expression in the list.
Syntax
COALESCE (expr1, expr2, … exprn)
In the syntax:
expr1 returns this expression if it is not null
expr2 returns this expression if the first expression is null and this expression is not null
exprn returns this expression if the preceding expressions are null
Note that all expressions must be of the same data type.



Leave a Reply 6

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


sri

sri

answer is ABD

dames

dames

Can’t be A. When list_price equals min_price, its output is 0.

Mr. T

Mr. T

B and D are correct.
Their output is always the corresponding list_price.

Anand

Anand

Return value :

A(10000,20000,0)
B(10000,20000,30000)
C(8000,null,30000)
D(10000,20000,30000)

Suh

Suh

Wow, A is wrong bc list_price = min_price.

Suh

Suh

In the third row