Compute Weekly Authorisation Rate by Issuer Country and Method
Last updated: November 29, 2026
Quick Overview
Given a table of authorisation attempts, write a SQL query that returns the authorisation rate for each issuer country and payment method over one week, excluding technical errors and merchant retries, ordered from worst to best.
Adyen
November 29, 20260
0
0 solved
Given a table of authorisation attempts, write a SQL query that returns the authorisation rate for each issuer country and payment method over one week, excluding technical errors and merchant retries, ordered from worst to best.
Authorisation rate is the metric Adyen's merchants watch most closely, and data teams build the pipelines and dashboards that break it down. The interviewer checks that the candidate defines the denominator carefully (what counts as an attempt), uses conditional aggregation, and avoids small-sample noise.
What the Interviewer Expects
- Ask how attempts, retries and technical errors are represented before writing SQL
- Use conditional aggregation in one pass instead of joining two counts
- Use half-open date ranges on the timestamp
- Filter out tiny groups with HAVING so noisy rates do not dominate
- Explain how the result could be validated against a known total
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you show the change versus the previous week in the same query?
- Should the rate be counted per attempt or per unique shopper intent? What changes?
- How would you make this query fast on billions of rows in PostgreSQL?
- How would you weight countries by volume to build a single headline rate?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table authorisations(psp_reference, created_at, issuer_country, payment_method, result_code, is_retry). I would confirm: result codes include Authorised, Refused and technical outcomes like Error, a...
Approach
Filter to one week with a half-open range, keep only issuer decisions, drop retries, then group by country and method. Compute authorised attempts with a CASE inside SUM and divide by the count, multi...