Each payment logs events 'initiated', 'authorized', 'captured' or 'failed' (the same event can be logged more than once because of retries). A payment counts at a funnel stage only if it also reached every earlier stage: initiated -> authorized -> captured (a 'captured' log without an 'authorized' log does not count as captured). Payments that were never initiated are ignored. For each method return method, initiated, authorized, captured (distinct payments at each stage), auth_rate_pct = 100 * authorized / initiated and capture_rate_pct = 100 * captured / authorized, both ROUND to 1 (NULL when the denominator is 0). Order by method.
| Column | Type |
|---|---|
| payment_id | INTEGER |
| method | TEXT |
| event | TEXT |
| event_time | TIMESTAMP |
| payment_id | method | event | event_time |
|---|---|---|---|
| 1 | UPI | initiated | 2026-04-01 10:00:00 |
| 1 | UPI | authorized | 2026-04-01 10:00:04 |
| 1 | UPI | captured | 2026-04-01 10:00:09 |
| 2 | UPI | initiated | 2026-04-01 10:05:00 |
| 2 | UPI | authorized | 2026-04-01 10:05:03 |
| 3 | UPI | initiated | 2026-04-01 10:07:00 |
| 3 | UPI | failed | 2026-04-01 10:07:20 |
| 4 | CARD | initiated | 2026-04-01 11:00:00 |
| method | initiated | authorized | captured | auth_rate_pct | capture_rate_pct |
|---|---|---|---|---|---|
| CARD | 2 | 1 | 1 | 50 | 100 |
| NETBANKING | 2 | 1 | 0 | 50 | 0 |
| UPI | 3 | 2 | 1 | 66.7 | 50 |
Solve it in the live editor on this page — run on sample data, then submit against hidden tests.
‹ Rapid Repeat Card Charges · Wallet Balance With Compliance Resets ›
{{ totalCount }} questions in the style asked at Amazon, Microsoft, Google, Meta, Flipkart and more — {{ hardPct }}% Hard. Write SQL in a real database engine in your browser, run it on sample data, then evaluate against hidden tests.
Company tags show where this type of question is commonly reported in interviews. Questions, data and solutions are written by TechTown.
{{ cur.statement }}
No submissions yet. Press Evaluate to submit your query.
{{ solutionSql }}
{{ out.error }}
You have solved your 3 free questions — nice work! Log in (free) to unlock all 150 questions, keep your streak and appear on the leaderboard.