Code RoomMonthly active users query spec
MediumPrep Room Coding #3976

Monthly active users query spec

Vibe & agenticDatabases & SQLMid–Senior~15 min

You want an AI agent to write a SQL query for a monthly-active-users report from an `events` table (columns: user_id, event_type, occurred_at) on Postgres. Write the prompt so the query is correct and not just plausible. What context and definitions must you supply, and where do vague analytics prompts go wrong?

Implement
count_monthly_active_users(event_lines: list[str], active_types: list[str], excluded_users: list[str], month_prefix: str) → int
Examples
in[["u1|login|2026-01-05T10:00:00Z","u1|login|2026-01-06T10:00:00Z","u2|login|2026-01-07T10:00:00Z"],["login"],[],"2026-01"]out2
in[["u1|login|2026-01-05T10:00:00Z","u2|page_view|2026-01-05T10:00:00Z","bot1|login|2026-01-05T10:00:00Z"],["login"],["bot1"],"2026-01"]out1
What a strong answer looks like

Treat the AI’s output as a draft to verify, not an answer to trust. Name the specific flaw and the input that triggers it, say how you’d catch it (tests, edge cases, reading critically), and how you’d re-prompt or decompose to get it right.

0:00 of about 15 min

Vibe & agentic: describe the solution in plain language (or narrate it) and the coach grades your approach.

Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.