ISRO 2020 · SQL Queries

MCQ · 1 mark · Problem DBMS-SQL-0062

Properties of 'DELETE' and 'TRUNCATE' commands indicate that
  1. A
    After the execution of 'TRUNCATE' operation, COMMIT, and ROLLBACK statements cannot be performed to retrieve the lost data, while 'DELETE' allow it
  2. B
    After the execution of 'DELETE' and 'TRUNCATE' operation retrieval is easily possible for the lost data
  3. C
    After the execution of 'TRUNCATE' operation, COMMIT and ROLLBACK statements can be performed to retrieve the lost data, while 'DELETE' does not allow it
  4. D
    After the execution of 'DELETE' and 'TRUNCATE' operation no retrieval is possible for the lost data

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solution\[\boxed{\text{DELETE: DML, logged, can be rolled back;}\quad \text{TRUNCATE: DDL, auto-commits, cannot}}\](A) DELETE removes rows inside the transaction, so a ROLLBACK (before COMMIT) restores them; TRUNCATE is DDL and commits implicitly, so the data cannot be rolled back — correct.(B) TRUNCATE data cannot be rolled back — incorrect.(C) This swaps the two commands — incorrect.(D) DELETE can be rolled back — incorrect.(In the original ISRO paper, option C repeated option A with the words reordered; it is rewritten here so that exactly one option is right.)Answer: A

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com