Typical SQL questions that involve window functions
Write a PostgreSQL query against account_transactions that returns only posted transactions and calculates the requested per-account metrics.
transaction_id, account_id, transaction_date, amount, sequence_number, amount_rank, and running_total.account_id, transaction_date, and transaction_id.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| account_id | VARCHAR(20) | Account associated with the transaction |
| transaction_date | DATE | Date the transaction occurred |
| amount | DECIMAL(10,2) | Transaction amount, which may be missing |
| status | VARCHAR(20) | Transaction processing status |