Your question is Top 10% Customers by Volume. Start with the requirements and the three tables on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Bank of America Merrill Lynch wants to identify its highest-volume customers for the latest completed calendar quarter. Transaction volume is defined as the sum of the absolute monetary value of valid posted transactions on open accounts.
Write a PostgreSQL query that returns the top 10% of eligible customers by transaction volume for the last completed calendar quarter. The sample data represents an execution date of 2026-08-29, so the reporting period is 2026-04-01 through 2026-06-30.
| Column | Type | Description |
|---|---|---|
| customer_idPK | INTEGER | Unique customer identifier |
| customer_name | VARCHAR(100) | Customer full name |
| customer_segment | VARCHAR(40) | Customer coverage segment |
| Column | Type | Description |
|---|---|---|
| account_idPK | INTEGER | Unique account identifier |
| customer_id | INTEGER | Owner of the account |
| account_status | VARCHAR(20) | Account lifecycle status |
| opened_date | DATE | Date the account was opened |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INTEGER | Unique transaction identifier |
| account_id | INTEGER | Account associated with the transaction |
| transaction_date | DATE | Transaction posting date |
| amount | NUMERIC(14,2) | Signed monetary transaction amount |
| transaction_status | VARCHAR(20) | Transaction processing status |