一、原题
二、题目翻译
三、题目解析
Evaluate the following SQL statements:
DELETE FROM sales;
There are no other uncommitted transactions on the SALES table.
Which statement is true about the DELETE statement?
A. It removes all the rows as well as the structure of the table
B. It removes all the rows in the table and deleted rows cannot be rolled back
C. It removes all the rows in the table and deleted rows can be rolled back
D. It would not remove the rows if the table has a primary key
答案: C
DELETE FROM sales;
There are no other uncommitted transactions on the SALES table.
Which statement is true about the DELETE statement?
A. It removes all the rows as well as the structure of the table
B. It removes all the rows in the table and deleted rows cannot be rolled back
C. It removes all the rows in the table and deleted rows can be rolled back
D. It would not remove the rows if the table has a primary key
答案: C
二、题目翻译
评估下面的SQL语句:
DELETE FROM sales;
SALES表上,没有其它的未提交事务。
关于上面的DELETE语句,下面哪句描述是正确的?
A.删除了表中所有的行,包括表结构。
B.删除了表中所有的行,并且删除的行不能回滚。
C.删除了表中所有的行,并且删除的行可以回滚。
D.如果这个表有主键,则不能删除行。
DELETE FROM sales;
SALES表上,没有其它的未提交事务。
关于上面的DELETE语句,下面哪句描述是正确的?
A.删除了表中所有的行,包括表结构。
B.删除了表中所有的行,并且删除的行不能回滚。
C.删除了表中所有的行,并且删除的行可以回滚。
D.如果这个表有主键,则不能删除行。
三、题目解析
DELETE语句,后面没有加WHERE条件,表示删除所有的行数据,但表结构还在,而且,删除的数据是可以回滚的,因为DELETE会记录undo信息。
本文分析了Oracle中的DELETE语句,特别是当没有WHERE子句时如何删除所有行。在11g环境下,如果对SALES表执行`DELETE FROM sales;`,尽管所有行都会被删除,但这些删除操作是可以回滚的,因为系统会记录undo信息。即使表包含主键,删除的行也能通过回滚操作恢复。
501

被折叠的 条评论
为什么被折叠?



