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

Question

You ask an AI to write a SQL migration that adds a `NOT NULL` column `status` defaulting to `'active'` to a 200M-row Postgres `orders` table. It writes `ALTER TABLE orders ADD COLUMN status text NOT NULL DEFAULT 'active';`. In staging it's instant. You ship to prod and it takes a full table lock for 9 minutes, taking down checkout. You re-prompt 'make it not lock'; it wraps the same statement in a transaction, which changes nothing. What did the model not know, and how do you re-steer?

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.