What would be the outcome of the above SQL statement?

View the Exhibits and examine the structures of the COSTS and PROMOTIONS tables.
Evaluate the following SQL statement:
SQL> SELECT prod_id FROM costs
WHERE promo_id IN (SELECT promo_id FROM promotions
WHERE promo_cost < ALL
(SELECT MAX(promo_cost) FROM promotions
GROUP BY (promo_end_datepromo_
begin_date)));
What would be the outcome of the above SQL statement?

View the Exhibits and examine the structures of the COSTS and PROMOTIONS tables.
Evaluate the following SQL statement:
SQL> SELECT prod_id FROM costs
WHERE promo_id IN (SELECT promo_id FROM promotions
WHERE promo_cost < ALL
(SELECT MAX(promo_cost) FROM promotions
GROUP BY (promo_end_datepromo_
begin_date)));
What would be the outcome of the above SQL statement?

A.
It displays prod IDs in the promo with the lowest cost.

B.
It displays prod IDs in the promos with the lowest cost in the same time interval.

C.
It displays prod IDs in the promos with the highest cost in the same time interval.

D.
It displays prod IDs in the promos with cost less than the highest cost in the same time interval.



Leave a Reply 3

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


SM

SM

D is correct, but there is a mistake.ORA-00904: “promo_end_datepromo_begin_date”
“%s: invalid identifier”, “GROUP BY” must be (promo_end_date – promo_begin_date).

Eamon

Eamon

Assuming D is correct, and apart to what SM mentioned above there is another problem

D states that ….
“It displays prod IDs in the promos with cost less than the highest cost in the same time interval.”
however the query does not ensure that the promos were in the same time interval.
??

Any suggestions would be appreciated.

user

user

why D is correct ?
< ALL display less than the minimum cost in the same time interval, not less than the highest cost, in this statement the next maximum amount can be displayed.

if any one have an explanation please replay!!!