~/ learn/ comp-378/ cards/ Transactions & ACID
1 of 5

Atomicity demo (rollback): set a savepoint, move 50000 from project 1 to project 2 with two UPDATEs, then ROLLBACK TO the savepoint and SELECT to confirm BOTH budgets returned to their original values — the half-done transfer left no trace.

Atomicity demo (rollback): set a savepoint, move 50000 from project 1 to project 2 with two UPDATEs, then ROLLBACK TO the savepoint and SELECT to confirm BOTH budgets returned to their original values — the half-done transfer left no trace.

Answer

SAVEPOINT before_transfer; UPDATE projects SET budget = budget - 50000 WHERE project_id = 1; UPDATE projects SET budget = budget + 50000 WHERE project_id = 2; ROLLBACK TO SAVEPOINT before_transfer; SELECT project_id, name, budget FROM projects WHERE project_id IN (1, 2) ORDER BY project_id;

space flip · ← → navigate · esc to exit
NORMAL ~/memra/library/a0ac3490-1cb0-496f-9e0c-9bdb00816088/flashcard utf-8 LF