Search ⌘K
PayPal
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 ...

Foundations Track
Easy
15 min
query basics
aggregation

Company labels are directional practice context, not official interview guidance.

Timer 00:00
Back to practice

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.

Prereq: query basics
Prereq: filtering

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 INT
account_id INT
amount INT
transaction_type VARCHAR(10
transaction_idaccount_idamounttransaction_type
110080credit
210030debit
310140credit
410110debit
510115debit
610255credit
Editor
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.