Write SQL and Python, run instantly in your browser, and track your progress.
You are a Payments Analyst at Amazon. The team wants to highlight standout transactions by method. For each method, your task is to return the two largest successfully captured payments, showing the payment identifier, amount, provider, and a rank (1 = largest). Consider only transactions denominated in the standard currency. Sort by method alphabetically; within each method, largest first and break ties by the smallest payment identifier.
| Column Name | Type |
|---|---|
| payment_id | INTEGER |
| order_id | INTEGER |
| method | TEXT |
You are a Payments Analyst at Amazon. The team wants to highlight standout transactions by method. For each method, your task is to return the two largest successfully captured payments, showing the payment identifier, amount, provider, and a rank (1 = largest). Consider only transactions denominated in the standard currency. Sort by method alphabetically; within each method, largest first and break ties by the smallest payment identifier.
| Column Name | Type |
|---|---|
| payment_id | INTEGER |
| order_id | INTEGER |
| method | TEXT |
| processor |
| processor |
| TEXT |
| TEXT |
| amount | REAL |
| amount | REAL |
| currency | TEXT |
| currency | TEXT |
| status | TEXT |
| status | TEXT |
| transaction_id | TEXT |
| transaction_id | TEXT |
| auth_time | TEXT |
| auth_time | TEXT |
| capture_time | TEXT |
| capture_time | TEXT |
| refund_time | TEXT |
| refund_time | TEXT |
| payment_id | order_id | method | processor | amount | currency | status | transaction_id | auth_time | capture_time | refund_time |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | apple_pay | stripe |
| payment_id | order_id | method | processor | amount | currency | status | transaction_id | auth_time | capture_time | refund_time |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | apple_pay | stripe |
| method | payment_id | amount | processor | method_rank |
|---|---|---|---|---|
| apple_pay | 48 | 2111.92 | braintree | 1 |
| apple_pay | 31 | 85.68 | paypal | 2 |
| bank_transfer | 5 | 629.34 | stripe | 1 |
| method | payment_id | amount | processor | method_rank |
|---|---|---|---|---|
| apple_pay | 48 | 2111.92 | braintree | 1 |
| apple_pay | 31 | 85.68 | paypal | 2 |
| bank_transfer | 5 | 629.34 | stripe | 1 |
Showing first 5 of 12 rows. Top 2 payments per method by amount.
Showing first 5 of 12 rows. Top 2 payments per method by amount.
| 55.32 |
| 55.32 |
| USD |
| USD |
| captured |
| captured |
| TX200002 |
| TX200002 |
| 2025-08-20 07:01:34 |
| 2025-08-20 07:01:34 |
| 2025-08-20 15:01:34 |
| 2025-08-20 15:01:34 |
| 2 | 2 | google_pay | square | 662.48 | USD | partial_refund | TX200003 | 2025-02-24 04:56:03 | 2025-02-26 06:56:03 | 2025-03-04 06:56:03 |
| 2 | 2 | google_pay | square | 662.48 | USD | partial_refund | TX200003 | 2025-02-24 04:56:03 | 2025-02-26 06:56:03 | 2025-03-04 06:56:03 |
| 3 | 3 | bank_transfer | internal | 88.66 | USD | captured | TX200004 | 2025-02-13 17:43:43 | 2025-02-14 16:43:43 |
| 3 | 3 | bank_transfer | internal | 88.66 | USD | captured | TX200004 | 2025-02-13 17:43:43 | 2025-02-14 16:43:43 |
| 4 | 4 | card | adyen | 322.87 | USD | captured | TX200005 | 2025-02-07 13:00:50 | 2025-02-09 11:00:50 |
| 4 | 4 | card | adyen | 322.87 | USD | captured | TX200005 | 2025-02-07 13:00:50 | 2025-02-09 11:00:50 |
| 5 | 5 | bank_transfer | stripe | 629.34 | USD | captured | TX200006 | 2025-06-24 03:59:58 | 2025-06-26 01:59:58 |
| 5 | 5 | bank_transfer | stripe | 629.34 | USD | captured | TX200006 | 2025-06-24 03:59:58 | 2025-06-26 01:59:58 |
| bank_transfer | 68 | 581.84 | braintree | 2 |
| bank_transfer | 68 | 581.84 | braintree | 2 |
| card | 22 | 2733.32 | braintree | 1 |
| card | 22 | 2733.32 | braintree | 1 |