Last answered:

26 Jun 2025

Posted on:

30 May 2024

1

ROLLBACK is affecting 0 rows

When I ran rollback query, it was showing '0 rows affected'. And when I used select query to display data from the 'department_dup' table, it was also not rolled back to the previous version. All the entries were same.

4 answers ( 0 marked as helpful)
Instructor
Posted on:

31 May 2024

2

Hi Rafi!
Thanks for reaching out.


There are very few reasons that could lead to this problem. We believe there is a setting that, for some reason, has been switched on or off, and that’s what causes the issue here.

In the SQL editor of MySQL Workbench, there is the possibility to toggle the autocommit mode by pressing a single button. This is the third of the three icons seen in the red rectangle. If you’ve pressed this button, it means that this mode will be turned on, and each statement will be committed immediately.


Please check if it has been left intact and you can see the three icons within the red rectangle in color, just as it is shown in the picture above.

(When the button has been pressed, the autocommit mode will be toggled on, and the tick and the X button will probably appear grey.



If this is the case, please toggle off the autocommit button by pressing the third of the icons to see the tick

and the X button in blue again.)



 

Hope this helps.
Best,
Tsvetelin

Posted on:

04 Jul 2024

0

Hi, 

I have same situation, I had autocommite mode. I toggled it off and nothing changed. After ROLLBACK I still have all data the same in database, it didn't change them back. Any clue?


Anna

Posted on:

26 Jun 2025

0

Anna,

After toggeling the autocommite mode, you have

1. To reconstruct the initial state of the table departments_dup. I used the code below.

TRUNCATE departments_dup;

INSERT INTO departments_dup
(
    dept_no,
    dept_name
)
SELECT 
    *
FROM 
    departments;

INSERT INTO departments 
VALUES
(
'd10',
'Business Analysis'
);

2. After that you schould repeat the steps from the section:

commit;

UPDATE departments_dup 
SET 
    dept_no = 'd011',
    dept_name = 'Quality Control';

SELECT 
    *
FROM
    departments_dup
ORDER BY dept_no;

ROLLBACK;

3. Than it should work.

 

Instructor
Posted on:

26 Jun 2025

0
Hi Dimiter!
Thanks for reaching out.


Thanks for sharing this piece of information with the Community!

Best,
Tsvetelin

Submit an answer