Library › Data AI › Business analysts

Explain why an AI-written SQL total is too high

  • For Business analysts
  • You practice Catching mistakes and made-up facts
  • Time about 5 minutes
  • Level Advanced

About this exercise

An AI wrote a query that reports $482,000 of revenue, but finance says $310,000. Write exactly 3 labeled lines in plain text, under 100 words: Problem, Evidence and Fix. Evidence must use the exact form 'Order 1001: 3 rows x $200 = $600 instead of $200', and Fix must start with the word 'Sum' and say how to compute the total without repeating orders, with no code block.

Common mistakes when you ask AI for this

  • Blaming the date filter. The AI suspects dates or timezones instead of the join. Try: Add: "The join to order_items repeats each order once per item."
  • Abstract evidence. The AI says 'rows are duplicated' without an example. Try: Add: "Evidence: order 1001 has 3 items so $200 counts as $600."
  • Pasting a new query. The AI rewrites a whole query in a code block. Try: Add: "Fix in one sentence, no code block: sum from orders alone."
  • Leaving the format to chance. The AI picks its own length and layout unless told the exact shape. Try: Add: "Plain text, no bold or headings."
  • Trusting the AI to count words. AI is bad at counting. Ask for a total word limit and it often lands over it. Try: Cap each part instead, for example "each line under 15 words."

What a strong prompt includes

  • Asks for three labels
  • Names the join cause
  • Uses the order example
  • Asks for a concrete fix
  • Rules out code

Practice this now ↑

Related exercises