Which DELETE statements are valid?

See the Exhibit and Examine the structure of SALES and PROMOTIONS tables: Exhibit:
You want to delete rows from the SALES table, where the PROMO_NAME column in the
PROMOTIONS table has either blowout sale or everyday low price as values. Which
DELETE statements are valid? (Choose all that apply.)

See the Exhibit and Examine the structure of SALES and PROMOTIONS tables: Exhibit:
You want to delete rows from the SALES table, where the PROMO_NAME column in the
PROMOTIONS table has either blowout sale or everyday low price as values. Which
DELETE statements are valid? (Choose all that apply.)

A.
DELETE FROM sales WHERE promo_id = (SELECT promo_id FROM promotions
WHERE promo_name = ‘blowout sale’) AND promo_id = (SELECT promo_id FROM
promotions WHERE promo_name = ‘everyday low price’);

B.
DELETE FROM sales WHERE promo_id = (SELECT promo_id FROM promotions

WHERE promo_name = ‘blowout sale’) OR promo_id = (SELECT promo_id FROM
promotions WHERE promo_name = ‘everyday low price’);

C.
DELETE FROM sales WHERE promo_id IN (SELECT promo_id FROM promotions
WHERE promo_name = ‘blowout sale’ OR promo_name = ‘everyday low price’);

D.
D DELETE FROM sales WHERE promo_id IN (SELECT promo_id FROM promotions
WHERE promo_name IN (‘blowout sale’,’everyday low price’));



Leave a Reply 3

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


sillyboy

sillyboy

Only C and D are correct.

B is wrong, you get:

ERROR at line 1:
ORA-01427: single-row subquery returns more than one row

Vietnam (anticomunism)

Vietnam (anticomunism)

I think solution can be: B,C,D or just C,D.
It depends on whether “blowout sale” and “everyday low price” just return one promo_id. Because when they return multiple promo_id then “=” operator will invalid lead to B is wrong.
This question is not clear!