Which DELETE statements are valid?

See the Exhibit and Examine the structure of SALES and PROMOTIONS tables:

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:

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 4

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


Bruno

Bruno

Why B is correct?

TSEKOS

TSEKOS

B IS CORRECT BECAUSE CHECK FOR ONE CONDITION AND AFTER CHECKS FOR THE OTHER (NOTE THE OR).

know

know

What if each:
SELECT promo_id FROM promotions WHERE promo_name = ‘blowout sale’
or
SELECT promo_id FROM promotions WHERE promo_name = ‘everyday low price’
will return more then one row? Then B will not be correct one.

You don’t know how many promo_name has value ‘blowout sale’ or ‘everyday low price’. That is why in C and D there is “IN” instead of “=”

I would say C and D is correct.

JT

JT

Im agree with Know, for me C and D are correct, because B can return more than a row in each condition.