Skip to content
ExamSpine

Answer it

P1 a3 wallet transaction

4 marksYou mark it yourself against the marking points

A school canteen app lets students send credit to each other. When Mia (student_id 31) sends 5 credits to Leo (student_id 42), the app runs these two statements on the Wallet table.

UPDATE Wallet SET balance = balance - 5
WHERE student_id = 31;
UPDATE Wallet SET balance = balance + 5
WHERE student_id = 42;

(a) Explain why the two statements must be run as a single transaction. [2]

(b) The server crashes after the first statement has run but before the second. Outline what ROLLBACK does in this situation. [1]

(c) After COMMIT, the server loses power. State the ACID property that guarantees the transfer is still recorded when it restarts. [1]

[4]