1/30
Part 1 of 5 · The methodLearn

Four generated queries that run and are wrong

One senior data scientist's report from an OpenAI loop describes this round: the interviewer hands over modular AI-generated SQL or Python and asks what its logic is and what's wrong with it (1 report). Another OpenAI data scientist report, from September 2026, lists 20 to 25 minutes of hands-on SQL in its live technical screen (1 report). Each is a single report, but 20 minutes isn't long, so the method has to be quick. Our version of the practice reads like this:

An assistant wrote four queries against users(user_id, signup_date, country) and events(user_id, event, event_date): daily active users, day-7 retention, conversion by country, and the users who never purchased. Each one runs and returns a tidy table. For each, tell me what it was meant to compute, what it actually computes, and fix it.

The practice comes in four levels, one query each. Level 1 is DAILY_ACTIVE_USERS, level 2 DAY7_RETENTION, level 3 CONVERSION_BY_COUNTRY, and level 4 NEVER_PURCHASED, where the events table holds a guest purchase with no user. Each has one bug that raises no error.

You don't fix them yet. The lesson builds a routine first: read the question back, read the query in the order it runs, and check it on a fixture you can answer by hand. Then it takes the bug classes one at a time: counts, joins, NULLs, integer division and dates. At the end you fix all four queries, level by level, in an interview simulation with a 40-minute timer.

This lesson builds on the SQL window functions lesson, which wrote queries from a blank file. Here the query is already written, and the skill is reading it.