Data
Answer business questions in SQL
A seeded database and the queries that answer what was asked.
Fill it in
What you actually need to know.
If you have it.
Over the same queries.
Your prompt
Answer these questions. [the questions] Restate each question precisely before writing SQL. "How many active customers" has at least four answers depending on what active means and over what window, and the query is worthless until that is settled. Say which definition you used. Write the query so a reader can check it: CTEs with names, no nested subqueries three deep, and a comment where the logic is not obvious. Sanity-check every result against something you already know. A number that is ten times too large usually means a join fanned out. Build a dashboard over the same queries, so the numbers cannot diverge.
Use Answer business questions in SQLOpens with everything above already filled in.
Why this works
"How many active customers" has at least four answers depending on the definition and the window, and the query is worthless until that is settled. This restates each question precisely, says which definition it used, and sanity-checks every result.