168. View the Exhibit and examine the description 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.)
delete from sales
where promo_id=(select promo_id from promotions where)
A. DELETE FROM sales
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');
FROM promotions
WHERE promo_name = 'blowout sale'
OR promo_name = 'everyday low price');
D. DELETE FROM sales
WHERE promo_id IN (SELECT promo_id
FROM promotions
WHERE promo_name IN ('blowout sale','everyday low price'));
Answer: BCD
答案解析:
题意要求:从SALES表中删除行,条件为PROMOTIONS表中PROMO_NAM列的值为blowout sale或者everyday low price)
BCD这三个选项是等价的。
而A的where条件中的AND不满足题意要求。