SQL QuestSQL Interview Questions › Conditional Logic

Days to KYC Verification by Country

MediumFreeQuerying BasicsConditional LogicAggregation & GroupingNULL HandlingDate Functions

Onboarding latency, with the NULLs counted rather than lost. users.kyc_verified_at is the moment identity checks passed — and NULL for users who never completed them. For each country, average the days from signup_date to kyc_verified_at over the verified users, and count the unverified ones separately.

Return country, verified_users (users with a kyc_verified_at), unverified_users (users where it is NULL) and avg_days_to_kyc (rounded to 1 decimal). Order by avg_days_to_kyc ascending, then country ascending.

Solve it in the browser editor →

Runs on SQLite in your browser, graded against the expected result, no signup. A wrong answer gets a diagnosis, not just "incorrect".

Schema

users

user_idsignup_datecountryhome_currencyplanplan_sincekyc_verified_atreferred_bybirth_year
12025-06-01IEEURstandard2025-06-012025-06-03 16:00:00NULL1972
22025-06-02FREURstandard2025-06-022025-06-04 16:00:00NULL1979
32025-06-03GBGBPstandard2025-06-032025-06-08 04:00:00NULL1977

Expected output: country=DE, verified_users=15, unverified_users=1, avg_days_to_kyc=2 ...

Hint

COUNT(kyc_verified_at) skips NULLs and AVG ignores them, so the verified figures need no filter; the unverified count is SUM(CASE WHEN kyc_verified_at IS NULL THEN 1 ELSE 0 END).

Concepts

SELECT julianday CASE GROUP BY NULL Handling AVG Date Functions + NULL Handling

Practise the topic: SQL practice questions · CASE WHEN practice · GROUP BY exercises · NULL handling practice · Date function practice

In these company practice sets

Revolut

A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.

Related questions

Movie Rating Tier BreakdownMedium · FreeGenre Financial ReportMedium · FreeDepartment Compensation ReportMedium · FreePivot: Order Status by CountryMedium · FreeGenre Box Office ReportMedium · FreeFare Imputation AnalysisMedium · Free

Where would this cost you points in an interview?

Ten questions, no signup: a Skillmap across nine SQL skills and the one to fix first.

Take the readiness test