Which DELETE statements are valid?

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.)

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));

D.
DELETE FROM (SELECT* FROM order_items i.orders o WHERE i.order_id = o.order_id
AND order_status IN (0,1));



Leave a Reply 4

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


ming

ming

I don’t understand D. I have tested it and it proves to be correct. But how come it only deletes the child table (order_items), but not the parent table (orders)

lucimara

lucimara

A Questão D está errada

ERRO na linha 1:
ORA-01752: nÒo Ú possÝvel a deleþÒo a partir da view sem ter exatamente uma
tabela preservada pela chave

lucimara

lucimara

D is incorrect .

SQL> DELETE FROM (SELECT *
2 FROM order_items i, orders o
3 WHERE i.order_id = o.order_id
The the 4 AND order_status IN (0, 1));

DELETE FROM (SELECT *
FROM order_items i, orders o
WHERE i.order_id = o.order_id
The AND order_status IN (0, 1))

ORA-01752: can not be removed from the do not have a key to save the table view

Ab Hin

Ab Hin

Answer is: A,C,D