View the Exhibit and examine the structure of the PROMOTIONS table.
Evaluate the following SQL statement:
SQL>SELECT promo_name,CASE
WHEN promo_cost >=(SELECT AVG(promo_cost)
FROM promotions
WHERE promo_category=’TV’)
then ‘HIGH’
else ‘LOW’
END COST_REMARK
FROM promotions;
Which statement is true regarding the outcome of the above query?
A.
It shows COST_REMARK for all the promos in the table.
B.
It produces an error because the subquery gives an error.
C.
It shows COST_REMARK for all the promos in the promo category ‘TV’.
D.
It produces an error because subqueries cannot be used with the CASE expression.
Yes, A.
Tricky question…
Can someone explain this please? Can’t figure it out. Is there something about having COST_REMARK at the END that overwrites the then and else clauses ?
A is the correct one.