Explain window functions. What is the difference between ROW_NUMBER(), RANK(), and DENSE_RANK()?
Using the provided payments table, calculate successful payment totals per account and currency, then apply all three ranking functions within each currency. Include a deterministic tie-breaker for ROW_NUMBER() and exclude unsuccessful or incomplete payments.
currency, account_id, and total_amountrow_number_rank, rank_value, and dense_rank_valuecurrency, total_amount descending, and account_id ascending| Column | Type | Description |
|---|---|---|
| payment_idPK | INT | Unique payment identifier |
| account_id | INT | Account associated with the payment |
| currency | VARCHAR(3) | Three-letter payment currency code |
| amount | DECIMAL(12,2) | Payment amount in the payment currency |
| status | VARCHAR(20) | Payment processing status |