SAVEPOINT

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 »

Transactions SQL

Transactions play a crucial role in maintaining data integrity. Transaction control statements in SQL provide the tools necessary to manage the execution of SQL statements, ensuring that operations are (ACID): atomic consistent isolated durable   Atomic:single unit of work. All committed or all roll back. Consistency: Gurantees relationships between tables Isolation: each transaction is isolated

Transactions SQL Read More »

Scroll to Top