日期:2014-05-16 浏览次数:20578 次
转载请注明出处:http://blog.csdn.net/guoyjoe/article/details/10475707
正确答案:ACD
根据题库,操作如下:
A答案能删除:
oe@OCM> delete from order_items 2 WHERE order_id IN (SELECT order_id FROM orders 3 WHERE order_status IN(0,1)); 110 rows deleted. oe@OCM> rollback; Rollback complete.
oe@OCM> DELETE * 2 FROM order_items 3 WHERE order_id IN(SELECT order_id 4 FROM orders 5 WHERE orders 6 WHERE order_status IN(0,1)); DELETE * * ERROR at line 1: ORA-00903: invalid table name
oe@OCM> delete from order_items i 2 WHERE order_id=(SELECT order_id FROM orders o 3 WHERE i.order_id=o.order_id AND 4 order_status IN(0,1)); 110 rows deleted. oe@OCM> rollback; Rollback complete.
oe@OCM> delete from(select * from order_items i,orders o 2 WHERE i.order_id=o.order_id AND order_status in(0,1)); 110 rows deleted.
oe@OCM> select dbms_metadata.get_ddl('TABLE','ORDERS') from dual;
DBMS_METADATA.GET_DDL('TABLE','ORDERS')
--------------------------------------------
CREATE TABLE "OE"."ORDERS"
( "ORDER_ID" NUMBER(12,0),
"ORDER_DATE" TIMESTAMP (6) WITH LOCAL TIME ZONE CONSTRAINT "ORDER_DATE_NN" NOT NULL ENABLE,
"ORDER_MODE" VARCHAR2(8),
"CUSTOMER_ID" NUMBER(6,0) CONSTRAINT "ORDER_CUSTOMER_ID_NN" NOT NULL ENABLE,
"ORDER_STATUS" NUMBER(2,0),
"ORDER_TOTAL" NUMBER(8,2),
"SALES_REP_ID" NUMBER(6,0),
"PROMOTION_ID" NUMBER(6,0),
CONSTRAINT "ORDER_MODE_LOV" CHECK (order_mode in ('direct','online')) ENABLE,
CONSTRAINT "ORDER_TOTAL_MIN" CHECK (order_total >= 0) ENABLE,
CONSTRAINT "ORDER_PK" PRIMARY KEY ("ORDER_ID")
USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 COMPUTE STATISTICS NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "EXAMPLE" ENABLE,
CONSTRAINT "ORDERS_SALES_REP_FK" FOREIGN KEY ("SALES_REP_ID")
REFERENCES "HR"."EMPLOYEES" ("EMPLOYEE_ID") ON DELETE SET NULL ENABLE,
CONSTRAINT "ORDERS_CUSTOMER_ID_FK" FOREIGN KEY ("CUSTOMER_ID")
REFERENCES "OE"."CUSTOMERS" ("CUSTOMER_ID") ON DELETE SET NULL ENABLE
) SEGMENT CREATION IMMEDIATE
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
NOCOMPRESS NOLOGGING
STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT)
TABLESPACE "EXAMPLE"