Library › Coding AI › Software developers

Explain a SQL query to an analyst in 4 labeled lines

Practice: Saying who it's for. About 5 minutes.

About this exercise

Analyst Rosa asks why the weekly report is missing some users. Explain the query in exactly 4 numbered lines labeled 'Rows:', 'Filter:', 'Groups:' and 'Watch out:', each under 25 words. 'Watch out:' must say that the INNER JOIN drops users with no sessions that week. Rosa knows SQL basics, so no tutorials, and don't rewrite the query. No code blocks, under 100 words.

Common mistakes when you ask AI for this

  • A line-by-line tutorial. The AI explains SELECT, JOIN and GROUP BY from scratch, which Rosa doesn't need. Try: Say: "Rosa knows SQL basics. Exactly 4 labeled lines."
  • No fixed labels. Without labels the explanation wanders and the key point gets buried. Try: Give them: "Rows:, Filter:, Groups:, Watch out:".
  • Burying the answer. Rosa's real question is the missing users; the AI may mention the join only in passing. Try: Add: "Watch out: the INNER JOIN drops users with no sessions that week."
  • A rewritten query. The AI 'fixes' the query with a LEFT JOIN, which changes what the report means. Try: Add: "Don't rewrite the query. No code blocks."

What a strong prompt includes

  • Says who it's for
  • Gives the labels
  • Names the missing-users cause
  • Rules out a rewrite
  • Caps each line

Practice this now ↑

Related exercises