| Balance |
select balance
from account
where account_id = ACCOUNT_ID;
|
| Deposit |
update account
set balance = balance + AMOUNT
where account_id = ACCOUNT_ID;
|
| Withdrawal |
update account
set balance = balance - AMOUNT
where account_id = ACCOUNT_ID;
|
| Transfer |
begin;
update account
set balance = balance + AMOUNT
where account_id = SOURCE_ACCOUNT_ID;
update account
set balance = balance - AMOUNT
where account_id = TARGET_ACCOUNT_ID;
commit;
|
| Audit |
select sum(balance)
from account;
|