Skip to content

Practice Bank Account Summary II

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1587
LeetCode Problem

Bank Account Summary II

Problem Statement

Tables: Users(account INT, name VARCHAR); Transactions(trans_id INT, account INT, amount INT, transacted_on DATE). Users.account and name are unique; Transactions.trans_id is unique. Positive amounts add money and negative amounts remove it. Every account starts at zero. Return name and balance for accounts with a sum of transaction amounts strictly greater than 10000. Output order is unrestricted.

Source: Bank Account Summary II on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Users table: +------------+--------------+ | account    | name         | +------------+--------------+ | 900001     | Alice        | | 900002     | Bob          | | 900003     | Charlie      | +------------+--------------+ Transactions table: +------------+------------+------------+---------------+ | trans_id   | account    | amount     | transacted_on | +------------+------------+------------+---------------+ | 1          | 900001     | 7000       |  2020-08-01   | | 2          | 900001     | 7000       |  2020-09-01   | | 3          | 900001     | -3000      |  2020-09-02   | | 4          | 900002     | 1000       |  2020-09-12   | | 5          | 900003     | 6000       |  2020-08-07   | | 6          | 900003     | 6000       |  2020-09-07   | | 7          | 900003     | -4000      |  2020-09-11   | +------------+------------+------------+---------------+
Output
+------------+------------+ | name       | balance    | +------------+------------+ | Alice      | 11000      | +------------+------------+

Related LeetCode Problems

Practice more problems similar to Bank Account Summary II.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.