rollback

SAVEPOINTS

Here is some example code: — Start a transaction START TRANSACTION; — Execute some statements INSERT INTO customers (id, name, email) VALUES (1, ‘John Doe’, ‘john@example.com’); SAVEPOINT before_update; UPDATE customers SET email = ‘new_email@example.com’ WHERE id = 1; — Check the intermediate result SELECT * FROM customers WHERE id = 1; — If needed, roll […]

SAVEPOINTS Read More »

Explicit Transactions

Let us take a look at the code below and break it down: START TRANSACTION; —-SET TRANSACTION NAME ‘NAME_OF_TRANSACTION’;— EITHER THIS OF THE PREVIOUS ONE MAY BE USED SELECT * FROM tbl_employee WHERE employee_number = 123; UPDATE TBL_EMPLOYEE SET employee_number = 122 WHERE employee_number = 123; SELECT * FROM tbl_employee WHERE employee_number = 123; ROLLBACK

Explicit Transactions Read More »

DELETE DATA SQL

Deleting all records is similar to the TRUNCATE funciton Basic syntax for deleting records. DELETE FROM table_name WHERE condition; Deleting All Records: To delete all records from a table, you can use a simple DELETE statement without a WHERE clause: Delete with JOIN: You can also use the DELETE statement with JOIN to delete records

DELETE DATA SQL Read More »

Scroll to Top