View the Exhibit and examine the structure of ORDERS and ORDER_ITEMS
tables.ORDER_ID is the primary key in the ORDERS table. It is also the foreign
key in the ORDER_ITEMS table where in it is created with the ONDELETE CASCADE
option. Which DELETE statement would execute successfully?
A. DELETE order_id FROM orders WHERE order_total < 1000;
B. DELETE orders WHERE order_total < 1000;
C. DELETE FROM orders WHERE (SELECT order_id FROM order_items);
tables.ORDER_ID is the primary key in the ORDERS table. It is also the foreign
key in the ORDER_ITEMS table where in it is created with the ONDELETE CASCADE
option. Which DELETE statement would execute successfully?
A. DELETE order_id FROM orders WHERE order_total < 1000;
B. DELETE orders WHERE order_total < 1000;
C. DELETE FROM orders WHERE (SELECT order_id FROM order_items);
D.DELETE orders o, order_items I WHERE o.order_id = i.order_id;
A: 没有DELETE order_id这种语法。只能DELETE FROM或者DELETE表名
C: WHERE (SELECT ...) 语法错误。WHERE ORDER_ID IN (SELECT ...)还差不多但是多此一举。
D: 没有DELETE ....表连接这种语法。可以DELETE (SELECT ...表连接) 但也有一些限制。