1. 程式人生 > >OCP-1Z0-051 第37題 drop table

OCP-1Z0-051 第37題 drop table

一、原題 You issued the following command to drop the PRODUCTS table:
SQL> DROP TABLE products;
What is the implication of this command? (Choose all that apply.)
A. All data along with the table structure is deleted.
B. The pending transaction in the session is committed.
C. All indexes on the table will remain but they are invalidated.
D. All views and synonyms will remain but they are invalidated
E. All data in the table are deleted but the table structure will remain

答案:ABD

二、題目翻譯 執行下面的命令刪除PRODUCTS表:
該命令隱含什麼意思?(選擇所有正確的選項)
A. 表結構和所有資料被刪除。
B. 該會話中的沒結束的事務被提交。
C. 表上所有的索引會保留,但是變為無效的。
D. 檢視和同義詞會保留,但是變為無效的。
E. 表中所有的資料被刪除,但是表結構保留。

三、題目解析

A選項正確,drop table就是刪表的,所以表結構和表中的資料都被刪除了。
B選項正確, 因為drop table是DDL操作,DDL會自動提交沒有提交的事務。
C選項不正確,表刪除後索引會被刪除,詳見後面解釋。
D選項正確,檢視和同義詞仍然存在,但是無效,因為基表沒有了。
E選項不正確,表都刪了,哪裡還有結構。

     

C選項,表刪除後索引會被刪除

摘錄如下:

       All table indexes and domain indexes are dropped, as well as any triggers defined on the table, regardless of who created them or whose schema contains them. If table is partitioned, then any corresponding local index partitions are also dropped.