Super learner
This user is a Super Learner. To become a Super Learner, you need to reach Level 8.
Last answered:

30 Sept 2022

Posted on:

28 Sept 2022

0

Why I'm not able to roll back the truncate statement via rollback statment????

I guess we can't roll back truncate statement same as drop
one more thing You guys forgot to use truncate statement and didn't even shows up truncate command to be executed
"TRUNCATE TABLE table_name"

2 answers ( 0 marked as helpful)
Posted on:

28 Sept 2022

3

Hello Mayank,

As per the MySQL documentation, TRUNCATE works by DROPping the table and re-creating it as blank, which is apparently faster than deleting rows one by one. Then, it causes an implicit commit, thus it cannot rolled back.

Best,
Carl

Instructor
Posted on:

30 Sept 2022

2

Hi Mayank and Carl!
Thanks for reaching out.

@: Carl
Thanks for sharing this piece of information with the Community!

@: Mayank
Carl said it all. TRUNCATE works by droping the table and re-creating it as blank and cannot be rolled back.



Hope this helps.
Best,
Tsvetelin

Submit an answer