What is transaction, write few sql queries
Asked in the Round 2 - Technical stage. Write PostgreSQL statements that demonstrate an atomic account transfer, recording the transfer only when the debit and credit succeed.
2001transfer_id, sender_name, recipient_name, amount, sender_balance, recipient_balancetransfer_id ascending| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique account identifier |
| account_name | VARCHAR(100) | Account holder name |
| balance | NUMERIC(12,2) | Current account balance |
| Column | Type | Description |
|---|---|---|
| transfer_idPK | INT | Unique transfer identifier |
| from_account_id | INT | Account sending the funds |
| to_account_id | INT | Account receiving the funds |
| amount | NUMERIC(12,2) | Transferred amount |
| transferred_at | DATE | Transfer date |
| memo | VARCHAR(200) | Optional transfer note |