Basic transaction for money transfer
SQL
Easy
2 views
Problem Description
Transfer 500 from account 1 to account 2 using a transaction.
Sample Test Case
Input:
Accounts(acc_id, balance)
Constraints
Assume enough balance
Official Solution
BEGIN; UPDATE Accounts SET balance = balance - 500 WHERE acc_id=1; UPDATE Accounts SET balance = balance + 500 WHERE acc_id=2; COMMIT;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!