252. View the Exhibit and examine the structure of ORDER_ITEMS and ORDERS
tables.You need to remove from the ORDER_ITEMS table those rows that have
an order status of 0 or 1 in the ORDERS table.
Which DELETE statements are valid? (Choose all that apply.)
A. DELETE FROM order_items
WHERE order_id IN (SELECT order_id
FROM orders WHERE order_status in (0,1));
B. DELETE * FROM order_items
WHERE order_id IN (SELECT order_id
FROM orders WHERE order_status IN (0,1));
C. DELETE FROM order_items i
WHERE order_id = (SELECT order_id FROM orders o
WHERE i.order_id = o.order_id AND order_status IN (0,1));
tables.You need to remove from the ORDER_ITEMS table those rows that have
an order status of 0 or 1 in the ORDERS table.
Which DELETE statements are valid? (Choose all that apply.)
A. DELETE FROM order_items
WHERE order_id IN (SELECT order_id
FROM orders WHERE order_status in (0,1));
B. DELETE * FROM order_items
WHERE order_id IN (SELECT order_id
FROM orders WHERE order_status IN (0,1));
C. DELETE FROM order_items i
WHERE order_id = (SELECT order_id FROM orders o
WHERE i.order_id = o.order_id AND order_status IN (0,1));
WHERE i.order_id = o.order_id AND order_status IN (0,1));
Answer: ACD
但是D被证明是错误的
SQL> DELETE FROM (SELECT *
2 FROM order_items i, orders o
3 WHERE i.order_id = o.order_id
4 AND order_status IN (0, 1)) ;
DELETE FROM (SELECT *
FROM order_items i, orders o
WHERE i.order_id = o.order_id
AND order_status IN (0, 1))
ORA-01752: 不能从没有一个键值保存表的视图中删除