Skip to main content
Admissions guidance, study banks, and career tools — get started on Shalyam

Accounts That Went Into Overdraft

Return the account_ids whose running balance was negative at any point. Order by account_id.

Table schema

Transactions(id INT PRIMARY KEY, account_id INT, type VARCHAR(6), amount INT)

Sample data

id | account_id | type | amount
1 | 1 | credit | 50
2 | 1 | debit | 80
3 | 1 | credit | 100
4 | 2 | credit | 100
5 | 2 | debit | 40

Discussion

No discussions yet.

Rewards · v2.1

Get Exclusive Insights with Every Issue

Join Shalyam Newsletter

Stay ahead in education, research, and innovation—straight to your inbox.