Your question is SQL for Payment Performance. 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.
Write a SQL query to analyze payment operations performance by merchant and region, including success rate, failure rate, and month-over-month trends at Adyen.
Use payment operations from January through April 2024. Include only successful and failed operations, and compare each merchant-region combination across every month in that period.
merchant_id, merchant_name, region_code, month, operation_count, success_rate, failure_rate, success_rate_mom_pp, and failure_rate_mom_pp.merchant_id, region_code, and month ascending.| Column | Type | Description |
|---|---|---|
| region_idPK | INT | Unique Adyen operating region identifier |
| region_code | VARCHAR(10) | Short region or country code |
| region_name | VARCHAR(100) | Display name of the operating region |
| Column | Type | Description |
|---|---|---|
| merchant_idPK | INT | Unique merchant identifier |
| merchant_name | VARCHAR(120) | Merchant display name |
| region_id | INT | Merchant's configured operating region |
| active | BOOLEAN | Whether the merchant is currently active |
| Column | Type | Description |
|---|---|---|
| operation_idPK | INT | Unique payment operation identifier |
| merchant_id | INT | Merchant associated with the operation |
| region_id | INT | Region where the operation was processed |
| processed_at | TIMESTAMP | Timestamp when the operation was processed |
| status | VARCHAR(20) | Payment outcome, such as success, failed, or pending |
| amount | NUMERIC(12,2) | Payment amount in the processing currency |