Which two statements are true regarding the DELETE and TRUNCATE commands? (Choose two.)
A.
DELETE can be used to remove only rows from only one table at a time.
B.
DELETE can be used to remove only rows from multiple tables at a time.
C.
DELETE can be used only on a table that is a parent of a referential integrity constraint.
D.
DELETE can be used to remove data from specific columns as well as complete rows.
E.
DELETE and TRUNCATE can be used on a table that is a parent of a referential integrity
constraint having ON DELETE rule.
Explanation:
Transactions, consisting of INSERT, UPDATE, and DELETE (or even MERGE) commands can be
made permanent (with a COMMIT) or reversed (with a ROLLBACK). A TRUNCATE command,
like any other DDL command, is immediately permanent: it can never be reversed.
The Transaction Control Statements
A transaction begins implicitly with the first DML statement. There is no command to explicitly start
a transaction. The transaction continues through all subsequent DML statements issued by the
session. These statements can be against any number of tables: a transaction is not restricted to
one table. It terminates (barring any of the events listed in the previous section) when the session
issues a COMMIT or ROLLBACK command. The SAVEPOINT command can be used to set
markers that will stage the action of a ROLLBACK, but the same transaction remains in progress
irrespective of the use of SAVEPOINTExplicit Transaction Control Statements
You can control the logic of transactions by using the COMMIT, SAVEPOINT, and ROLLBACK
statements.
Note: You cannot COMMIT to a SAVEPOINT. SAVEPOINT is not ANSI-standard SQL.
What explanation has to do with the question?
Answer A is not strictly true. It states that …
“DELETE can be used to remove only rows from only one table at a time.”
The issue here is alluded to by answer E. The ON DELETE rule.
If a FK is defined with ON DELETE CASCADE then if a row in the parent table is deleted, Oracle will delete the corresponding rows from the child table also. Hence 2 tables get rows deleted.
cheap league jerseys cheap custom jersey
“The fact that TRUNCATE doesn’t run ON DELETE triggers also sets it apart from normal DML operations (but some direct path DML operations also skip triggers, so that’s not a clear indicator)”
https://dba.stackexchange.com/questions/36607/why-is-truncate-ddl/36615#36615
So, even thought you can delete a row that is a parent of a referential integrity constraint, you can’t use TRUNCATE.
E is wrong. I think the answer is A