Skip to content
C

Commit a Fund Transfer

Easysql
Learn the Concept: COMMIT

Write a transaction that transfers 200 from account id 1 to account id 2 and commits it. Debit account 1 by 200, credit account 2 by 200, then COMMIT.

sql
CREATE TABLE accounts ( id INTEGER PRIMARY KEY, balance INTEGER NOT NULL ) ENGINE=InnoDB;

Sample data:

sql
INSERT INTO accounts (id, balance) VALUES (1, 1000), (2, 500);

Related Problems

Input (stdin)

Output

Run your code to see output here...