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

Question

An AI agent rewrote a slow analytics query and a backing SQL migration, claiming the new query "returns identical results, just faster" by replacing a correlated subquery with a window function and adding an index. The numbers in a spot-check on staging matched. How do you verify 'identical results' rigorously before this replaces a query that feeds finance dashboards, and what's the failure mode you're specifically guarding against?

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.