Seven Questions to Ask Before You Trust an AI's Answer About Your Data (before you paste it into the deck)
Published August 26, 2026
The 60-second version
- Silent failures are the danger. A query that runs with zero errors can still answer a completely different question than the one you asked.
- Three places to look: the tables it chose, the filters it applied, and the grain it aggregated at.
- No SQL, no trust. A number without its query attached is a rumour with formatting.
An AI can write a SQL query that runs in milliseconds, produces zero error messages, returns a beautifully formatted number, and still be answering a completely different question than the one you asked.
This is the most dangerous failure mode in modern data analytics. When code fails with a red syntax error, you know it broke. But when an AI produces a semantically wrong query, it fails in complete silence โ presenting an inaccurate number with 100% confidence.
The Silent Semantic Failure Trap
Before you take a number generated by an AI assistant or text-to-SQL tool and paste it into a slide deck for your CEO or board, run through these seven sanity checks. tape this to your monitor
1. Is there SQL behind the number?
The first filter is binary: did the AI show you the exact query it executed, or did it only give you a number?
A tool that shows only a summary number or a chart is asking for blind faith. If you cannot inspect the underlying SQL code, you cannot verify whether the calculation matches your company's definitions. A tool that displays the SQL behind every single number gives you, your analysts, and your engineers the ability to audit the logic in seconds.
2. Which table did it query?
In real-world databases and CRMs, the word "revenue" or "orders" rarely lives in just one table. You might have:
orders(gross order totals, including shipping and sales tax).order_line_items(individual product prices before discounts).stripe_transactions(net settled cash deposits after payment gateway fees).
-- โ The AI queries the raw orders table (Includes $15k in sales tax & shipping):
SELECT SUM(order_total) FROM orders WHERE status = 'paid';
-- โ
The finance team expects Net Product Revenue:
SELECT SUM(subtotal_price - discount_amount) FROM order_line_items;
The Check: Look at the FROM clause immediately. Did the AI pick the table your team actually considers the source of truth for that metric?
3. What does WHERE actually filter?
The WHERE clause is where "technically ran successfully" and "calculated the right number" most frequently diverge.
A classic example is handling cancelled orders. Many models write:
-- โ ๏ธ THE SQL NULL TRAP
SELECT SUM(order_total)
FROM orders
WHERE order_status != 'cancelled';
Why this breaks: In standard SQL three-valued logic, if an order is newly created and its order_status is NULL (unassigned), NULL != 'cancelled' evaluates to UNKNOWN, and that order is silently deleted from your report!
The Check: Verify that the WHERE clause:
- Filters out refunds and cancellations explicitly.
- Uses the correct date field (e.g.
order_created_atvsshipped_atvspaid_at). - Handles
NULLcolumns safely usingCOALESCEorIS NOT NULL.
4. Does the join key fan out rows?
A join on a non-unique key is the #1 reason an AI-generated number looks mysteriously 2x to 5x higher than reality.
Layman Example: If you ask for "Revenue and ad spend by day," an AI might join your orders table directly to your ad_spend table on date:
-- โ DANGEROUS FAN-OUT JOIN:
-- If 5 different ad campaigns ran on Monday, EVERY order placed on Monday
-- gets multiplied by 5 in the join!
SELECT
o.order_date,
SUM(o.order_total) AS multiplied_revenue
FROM orders o
JOIN campaign_spend s ON o.order_date = s.spend_date
GROUP BY o.order_date;
The Check: Did the AI aggregate each side of the join into a summary subquery or CTE before joining them on date?
5. Does the grain match the ask?
"Revenue by campaign" and "Revenue by campaign by day, summed" can return different totals if a user's subscription touches multiple touchpoints over time.
The Check: Look at the GROUP BY clause. Are the columns in GROUP BY matching the exact entity you asked for (e.g. customer_id vs order_id vs session_id)?
6. Would your experts recognize it?
You do not need to be a software engineer to sanity-check an AI query. Simply read the English translation of what the query is doing:
"The AI took all rows from the raw signups table from last week, counted every row regardless of email verification, and divided by total site visits."
If you mention that description to your Head of Growth and they say "Wait, we only count verified business emails as signups," you just caught a critical discrepancy before it reached executive leadership.
7. Zeroes, timezones, negatives?
AI models tend to assume a clean, idealized world. Real database data is messy:
- Zero-Spend Days: Does the query use
NULLIF(spend, 0)orSAFE_DIVIDEto prevent runtime crashes? - Timezone Drift: If your ad platform is in Eastern Time and your database stores timestamps in UTC, did the query convert timezones before grouping by day?
- Refund Amounts: Are refunds stored as negative numbers in the orders table, or as positive numbers in a separate
refundstable?
-- โ
Clean edge-case handling:
SELECT
DATE(order_created_at, 'America/New_York') AS local_day,
ROUND(SUM(net_revenue) / NULLIF(SUM(ad_spend), 0), 2) AS roas
FROM daily_metrics
GROUP BY 1;
The seven checks, pocket version run these before the deck โ
- Demand the SQL โ a number without its query is a rumour with formatting.
- Check the FROM table โ is it your team's source of truth for this metric?
- Read the WHERE in English โ refunds out, right date column, NULLs handled.
- Interrogate every JOIN โ could one left row match several right rows?
- Match GROUP BY to the noun โ customers means grouping by customer, not order.
- Translate it for a domain expert โ if they object, you caught it early.
- Assume messy data โ zero-spend guards, timezone conversion, refund signs.
The 60-second audit flowchart
The 60-Second Query Audit Flowchart
Process FlowCheck FROM Table Name
Is this our primary source of truth for this metric? (e.g. net line items vs gross orders)
Inspect WHERE Clause Filters
Are cancellations and refunds excluded? Is the date column created_at vs shipped_at? Are NULLs handled safely?
Verify JOIN Keys & Aggregation Grain
Are joined tables aggregated to the target grain first to avoid row multiplication fan-out bugs?
Confirm GROUP BY Entity & Edge Cases
Does the GROUP BY match the business question? Are zero-spend divisions safe from divide-by-zero crashes?
Quick gut-check
One question. Get it and the whole post clicks. 30 seconds, no grading!
A query runs with zero errors but sums gross_total instead of net_total. Which check catches it?
Why DataLens Always Ships the SQL
At DataLens, we believe that an analytics number without its accompanying SQL query is untrustworthy.
Every answer expands to show the exact query that produced it, and one click re-runs that query live to check the number hasn't drifted โ so you get the speed of natural-language exploration with the rigor of verified analytics engineering, and never have to take a figure on faith.
Takeaways for your next report
- A query that runs without errors can still answer a different question โ silent failures are the danger.
- Audit inside out: tables chosen, filters applied, grain aggregated โ in that order.
- Translate the query into one English sentence and let a domain expert object before your CEO has to.
- A number without its SQL is a rumour with formatting โ demand the query, every time.
Chinmay Raibagkar
About author โFounder of DataLens AI. He helps non-technical teams read their ad and database numbers with confidence โ which number to trust, what to do next, and what to ignore.