Code Room
Vibe codingHardvc-g079
Subject Ai prompt iterationLevel Senior–Staff~20 minCommon in Databases & SQL interviewsIndustries Software development, Technology

Question

You ask an AI to write a Postgres query for 'monthly active users' and it returns a clean `COUNT(DISTINCT user_id) ... GROUP BY date_trunc('month', event_time)`. The numbers look right in a quick check, so you ship it — then finance flags that March is double-counting versus their dashboard. You re-prompt 'fix the double counting' and it adds `DISTINCT` in three more places, changing nothing. What assumption did the model bake in, and how do you re-steer to actually fix it?

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.

Describe your solution

Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.

Run or narrate your approach, then ask the coach.