SQL Quest › SQL Interview Questions › Conditional Logic
Days to KYC Verification by Country
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_id | signup_date | country | home_currency | plan | plan_since | kyc_verified_at | referred_by | birth_year |
|---|---|---|---|---|---|---|---|---|
| 1 | 2025-06-01 | IE | EUR | standard | 2025-06-01 | 2025-06-03 16:00:00 | NULL | 1972 |
| 2 | 2025-06-02 | FR | EUR | standard | 2025-06-02 | 2025-06-04 16:00:00 | NULL | 1979 |
| 3 | 2025-06-03 | GB | GBP | standard | 2025-06-03 | 2025-06-08 04:00:00 | NULL | 1977 |
Expected output: country=DE, verified_users=15, unverified_users=1, avg_days_to_kyc=2 ...
Hint
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
A SQL Quest challenge matched to patterns reported for these companies — not a question any of them has published.
Related questions
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