Tuesday 9 June 2020

13. PGT Computer Science Question Discussion

which of the following with respect to SQL truncate statement is true?

    1. After deleting rows, truncate does not free the space containing table.
    2. We can use where clause with truncate statement
    3. We may roll back truncated data any time
    4. We may not be able to roll back in case of truncate in some databases.

truncate is a DDL Query and DDL query can not be rollback. truncate used to delete all the rows of the table at once, we can not delete any specific row using truncate, so where clause is not used with truncate. It does not delete the structure of the table, So it does not free the space which is occupy by the table definition, but free the space of table rows or data.
mysql> truncate emp;
 
So Answer will be Option (D)

No comments:

Post a Comment