How do window functions work? Write a query using ROW_NUMBER() or RANK() to find the top three highest-value transactions for each client account.
Use the provided client_accounts and transactions tables. Return the top three transactions per account, excluding transactions that do not belong to a known account.
account_id, account_name, transaction_id, amount, and transaction_rankaccount_id, then transaction_rank, then transaction_id| Column | Type | Description |
|---|---|---|
| account_idPK | INT | Unique client account identifier |
| account_name | VARCHAR(100) | Client account display name |
| account_type | VARCHAR(30) | Type of client account |
| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| account_id | INT | Client account associated with the transaction |
| amount | NUMERIC(12,2) | Transaction value |
| transaction_date | DATE | Date the transaction occurred |
| transaction_type | VARCHAR(30) | Transaction classification |