Payment Failure Rate by Currency
Problem
**[Asked at Stripe]**
Per currency, calculate total payments, failed count, failure rate (%), and
total lost amount (sum of failed payments).
Return `currency`, `total_count`, `failed_count`, `failure_rate` (2 dp),
`lost_amount`. Order by failure_rate descending.
Tables
Example rows — the live problem includes the full dataset.
payments
| id | status | amount | currency |
|---|
Expected output
Your answer should return 2 rows with the columns currency, total_count, failed_count, failure_rate, lost_amount.
Starter code (SQL)
SELECT *
FROM payments;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock