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
Data Manipulation (SQL/Python)
Data Engineer
Adyen
November 29, 2026
Data Engineer
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

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
Conditional aggregation
Metric definition
Date filtering
GROUP BY and HAVING
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. 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 Problems
Sample 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...


Submit Your Answer
Markdown supported

Related Questions