Resolved: mysql commit Lesson 12 _1 Delete part1
Hello,
Is there a situation where the COMMIT is not ROLLEDBACK?
insert into titles ( emp_no, title, from_date)
values (999903,'Senior Engineer','1997-10-01');
COMMIT;
select * from employees where emp_no = 999903; #1 row
select * from titles where emp_no>999900; #1row
delete from employees where emp_no=999903;
select * from employees where emp_no = 999903; #0 records.
select * from titles where emp_no>999900; #0record
ROLLBACK;
select * from employees where emp_no = 999903; #0 records
select * from titles where emp_no>999900; #0 records
I am not able to see the deleted row.
I did set the edit preferences as per instructions (checkbox in sql editor was turned off)
Appreciate any tips. I am unable to see where I could be wrong.
Regards
Hello all,
Instead of Commit. the following works for me.
SET autocommit=0;
START TRANSACTION;
# delete query
ROLLBACK;
I got this from stackoverflow.
Thanks.
Regards.
Hi Rajya!
Thanks for reaching out.
Thank you for sharing this with the Community!
Often, there are several ways to obtain a certain result/adjust a certain setting while working in MySQL.
Regarding Commit and Autcommit, you can also consider toggling the Autocommit button (which is something we suggest you didn't do throughout the course, since we've recorded all lectures with the idea to not press that button):
Hope this helps.
Best,
Martin
Thank you for this, I was having the same issue, it seems Autocommit may be turned on by default because I don't ever remember touching that button.
Hi Christopher!
Thanks for reaching out and confirming the solution helped you solve the issue.
In addition - yes, you may have either toggled the autocommit functionality by chance or, more probably so, the autocommit function may have been set to be on upon the installation of your version of Workbench by default.
Hope this helps.
Kind regards,
Martin