SQL QuestSQL Interview Questions › Aggregation & Grouping

Monthly Active Users

MediumFreeQuerying BasicsAggregation & Grouping

MAU is the number every fintech dashboard opens with, and the first question candidates report from the live round. Define an active user as one with at least one completed transaction in the calendar month. Bucket ts into months with strftime('%Y-%m', ts) and count each user once per month, however many transactions they made.

Return month (YYYY-MM) and active_users. One row per month with any completed transaction. Order by month 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

transactions

txn_iduser_idtstypeamountcurrencyamount_gbpfee_gbpmerchant_categorymerchant_countrycounterparty_user_idstatusdecline_reason
112025-06-14 11:01:51fx_exchange32271.15JPY167.811.68NULLNULLNULLcompletedNULL
212025-06-14 11:17:45bill_payment59.53EUR50.60utilitiesIENULLcompletedNULL
372025-06-16 10:06:38card_payment122.27EUR103.930shoppingESNULLcompletedNULL

Expected output: month=2025-06, active_users=10; month=2025-07, active_users=13 ...

Hint

COUNT(DISTINCT user_id) is what turns transactions into people. Alias the strftime expression as month and GROUP BY it.

Concepts

SELECT GROUP BY COUNT DISTINCT strftime Date Functions + Aggregation

Practise the topic: SQL practice questions · GROUP BY exercises

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

Class Survival BreakdownMedium · FreeDepartment Roster with GROUP_CONCATMedium · FreeMovie Rating Tier BreakdownMedium · FreeFull Survival Dashboard by ClassMedium · FreeGenre Financial ReportMedium · FreeDepartment Compensation ReportMedium · 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