Transaction Balance Over Threshold
Problem statement
You are given two tables, LOGIN and TRANSACT.
LOGIN
ACCOUNT CHAR(16)USERNAME CHAR(20)FIRST_NAME CHAR(20)LAST_NAME CHAR(30)
TRANSACT
ACCOUNT CHAR(16)AMOUNT INTTIMESTAMP DATE
TRANSACT contains every change made to an account. Credits are positive, debits are negative, and every account starts with a balance of 0.
Return exactly one column, USERNAME, containing every username whose account has a net balance strictly greater than 10000. Compute an account's net balance as the sum of all of its TRANSACT.AMOUNT values.
The output row order is not significant.
Table schema
Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.
LOGIN
Login identity records from the source schema.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ACCOUNT | Text | No | Account identifier; the source declares CHAR(16). |
| USERNAME | Text | No | Username; the source declares CHAR(20). |
| FIRST_NAME | Text | No | First name; the source declares CHAR(20). |
| LAST_NAME | Text | No | Last name; the source declares CHAR(30). |
TRANSACT
Account credits and debits from the source schema.
| Column | Type | Nullable | Description |
|---|---|---|---|
| ACCOUNT | Text | No | Account identifier; the source declares CHAR(16). |
| AMOUNT | Integer | No | Signed balance change; credits are positive and debits are negative. |
| TIMESTAMP | Date | No | Transaction date; the source declares DATE. |
Expected result
Your query or function must return these columns.
| Column | Type | Nullable | Description |
|---|---|---|---|
| USERNAME | Text | No | Username of an account whose balance exceeds 10000. |
Row order: any order is accepted. Numeric tolerance: 0.
Constraints
- For this practice version, every input cell is non-null.
LOGIN.ACCOUNTidentifies at most one login row. An account may have any number ofTRANSACTrows.- Text values respect the source-declared
CHARlengths. AMOUNTis a signed integer: positive values are credits and negative values are debits.TIMESTAMPis represented as an ISO date inYYYY-MM-DDform and does not affect the result.- Either table may be empty. An account with no transactions has balance
0, and transactions without a matchingLOGINrow contribute no username.
Source note: Original assessment screenshot showing the source table schema and prompt.