PayPal
Foundations Track · Easy · 15 min
Final Wallet Balance
For each account_id, calculate the final wallet balance. Credits add to the balance and debits subtract from it. Return account_id and final_balance ordered ...
Company labels are directional practice context, not official interview guidance.
Objective
Practice query basics through a PayPal-tagged business scenario.
Approach
Use this track to lock in clean query structure, basic filtering logic, and confidence with grouped output.
Company context
Company labels are directional practice context, not official interview guidance.
For each account_id, calculate the final wallet balance. Credits add to the balance and debits subtract from it. Return account_id and final_balance ordered by account_id.
wallet_transactions
| transaction_id | account_id | amount | transaction_type |
|---|---|---|---|
| 1 | 100 | 80 | credit |
| 2 | 100 | 30 | debit |
| 3 | 101 | 40 | credit |
| 4 | 101 | 10 | debit |
| 5 | 101 | 15 | debit |
| 6 | 102 | 55 | credit |
SQL workspace
Run queries against the protected question data, then submit once the result shape looks right.
Sign in to run SQL
Create a free account or sign in before running queries against protected question data.