TOPIC 16/3615 MINNOT STARTED

SQL and data questions with AI: ask, then prove

Use an AI tool to draft a database query from a plain question, then prove the answer: give it the table list, define your words, and check counts, a hand sample and a known total.

L1–L4 are part of the Pro pass

L0 Explain simply

Analogy: asking for directions. A clear answer may point to a different station from the one you meant. Checking another confident answer is not enough: both can use the wrong destination.

Daily List is a made-up to-do app (SYNTHETIC / TRAINING ONLY). Nina asks how many people used the app this week. Sam, the , must first establish what "used" means, which people count and which period the question covers. A query that runs successfully can still answer a different question.

(Structured Query Language) is used to work with database data. In this lesson, a row represents one user or one task and a column holds a fact about it. A describes the relevant tables, columns and relationships. A business definition states the intended meaning of a term such as active. A silent query error returns a result without a database error while computing the wrong thing.

The synthetic example below has two wrong queries returning 3 and the intended count returning 2. Agreement between the wrong totals is not independent confirmation. The table of signed-up people and the rows of tasks answer different questions.

The picture has a limit. People can misunderstand directions and a tool can ask for clarification or use supplied context. Neither a confident explanation nor a successful execution establishes the business meaning of a result.

PICTURE IT

The picture is the one the lesson above opens with. The table below shows how each part of it matches the work.

THE REAL JOB The picture helps a newcomer remember that a confident answer still needs a look at the street signs.

  1. Write the schema brief
  2. Define the business words
  3. Use approved read-only access controls
  4. Count, sample and compare
  5. Have a reader of Structured Query Language (SQL) review it
From a question to a checked result

HOW THE PICTURE MAPS

How each part of the picture matches the work
In the pictureIn the work
The local giving directionsThe artificial intelligence (AI) tool writing a query
Saying which station you meanThe business definition
The map of streets you hold upThe schema brief
Looking at the street signsCounts, a hand sample and a known total
Walking the wrong way with confidenceA silent query error

WHERE THIS PICTURE STOPS

  • A person or a tool can sound confident while giving incorrect directions; confidence is not a correctness check.
  • Street signs are the same for everyone, but a business word can mean different things to different teams.
  • A wrong turn costs a few minutes, while a wrong number in a report can reach a decision.

HOOK

Brief it, define it, prove it.

REMEMBER IT THIS WAY

A rule of thumb: if you see this, think that.

Check the agreed and compare the result with independently justified evidence, even when the query runs successfully.

What each part of the trick stands for
In the trickWhat it stands for
Big number quicklyThe query runs and gives a big number
Business definitionA written meaning for a word like active
Known totalCounts, a hand sample and a known total

A query can match the definition and still be wrong in a join, so check the counts too.

TELL A FRIEND

Give the tool the schema and agreed meaning, then inspect the route. Review the dialect, joins and filters; compare counts, samples and independently justified totals within their limits.

OFTEN MIXED UP WITH SQL for BAs: JOIN. That topic teaches joins. This one adds bounded query drafting, agreed definitions and independent checks of the result.

Sources & standards — 2 sources
  1. Regulatory guidance

    NIST AI 600-1, Generative Artificial Intelligence Profile ↗ — National Institute of Standards and Technology · NIST AI 600-1 (July 2024), selected sections 2.2, 2.4 and 2.8: plausible unsupported output, privacy and information integrity. Supports independent evidence and bounded claims, not a measured general SQL error rate.

    Business Analysis Academy, AI for analysts: only the exact selected evidence scope stated in notes; not binding global product requirements or validation of fictional examples. · Checked 2026-11-07

    July 2024. Actual read scope: Cover/intro; complete sections 2.2, 2.4, 2.6, 2.7, 2.8; selected action snippets only, not full section 3. Limits: No whole-document review or figure reuse claimed. No figure copied or integrated.

  2. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    What this simplifies: Daily List, cast and the three-user/four-task narrative are fictional. The existing three query strings, dates and counts are preserved and independently repeated on SQLite 3.53.1, yielding 2, 3 and 3. The original 3.40.1 statement is historical provenance. The fixed date 2026-11-02 and lower bound 2026-10-26 are worked-case values, not current operating dates or a complete live week query. The separate public ten-task project is untouched.

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

PRACTISE AND KEEP

Sources for this topic — 7 sources
  1. Implementation-specific

    SQLite: date/time functions ↗ — SQLite project · SQLite official Date And Time Functions, selected overview/return types, Time Values and modifier introduction read 7 November 2026; independent three-user/four-task and fixed-date experiment on SQLite 3.53.1. Not a whole manual or all-version compatibility claim.

    ISO text/julianday/date modifiers, numeric subtraction contrast. · Checked 2026-11-06

    Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.

  2. Implementation-specific

    Value expressions and aggregate filters (PostgreSQL documentation) ↗ — PostgreSQL · PostgreSQL 18 SQL Expressions, complete section 4.2.7 Aggregate Expressions: COUNT(*), COUNT(expression), DISTINCT and null handling. Actual selected primary read; no PostgreSQL execution and no generic DISTINCT repair claim.

    §4.2.7–8 aggregate/window expressions; §4.2.14 evaluation limits. PostgreSQL18 implementation, not a universal SQL mandate. · Checked 2026-11-06

    PostgreSQL18 publisher documentation opened on6November2026: §4.2.7–8 aggregate/window expressions; §4.2.14 evaluation limits. No execution on PostgreSQL is claimed; engine-specific examples remain scoped to18.

  3. Implementation-specific

    PostgreSQL18: date/time functions ↗ — PostgreSQL Global Development Group · PostgreSQL 18 Date/Time Functions and Operators, introduction/typed-comparison semantics and Table 9.32, selected current_date entries. Date-minus-integer and date/timestamp/time-zone boundaries are scoped to this documentation; not all engines or a complete business-week definition.

    §9.9 typed date arithmetic and truncation/timezones. · Checked 2026-11-06

    Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.

  4. Implementation-specific

    PostgreSQL18: SET TRANSACTION ↗ — PostgreSQL Global Development Group · PostgreSQL 18 SET TRANSACTION, complete substantive selected page: read-only access mode restricts command classes but is a high-level definition and does not prevent every disk write. Runtime authorisation, resource and disclosure controls remain separate.

    Read-only mode and isolation/snapshot characteristics. · Checked 2026-11-06

    Publisher documentation opened on6November2026. Engine/version scope is explicit; other database implementations may differ. Teaching queries are synthetic, not a required publisher template.

  5. Regulatory guidance

    NIST AI 600-1, Generative Artificial Intelligence Profile ↗ — National Institute of Standards and Technology · NIST AI 600-1 (July 2024), selected sections 2.2, 2.4 and 2.8: plausible unsupported output, privacy and information integrity. Supports independent evidence and bounded claims, not a measured general SQL error rate.

    Business Analysis Academy, AI for analysts: only the exact selected evidence scope stated in notes; not binding global product requirements or validation of fictional examples. · Checked 2026-11-07

    July 2024. Actual read scope: Cover/intro; complete sections 2.2, 2.4, 2.6, 2.7, 2.8; selected action snippets only, not full section 3. Limits: No whole-document review or figure reuse claimed. No figure copied or integrated.

  6. Market practice

    LLM06:2025 Excessive Agency ↗ — OWASP Foundation, GenAI Security Project · OWASP LLM06:2025 Excessive Agency, complete substantive entry: restrict functionality, permissions and autonomy; enforce approval/authorisation rather than rely on prompt wording. No claim SELECT or a copied dataset eliminates all risk.

    Business Analysis Academy, AI for analysts: only the exact selected evidence scope stated in notes; not binding global product requirements or validation of fictional examples. · Checked 2026-11-07

    2025 edition. Actual read scope: Complete substantive main body, lines 7–81; re-read 2026-11-07. Limits: Natural-language instructions do not replace runtime permissions; figures not reused. No figure copied or integrated.

  7. Simplified educational illustration

    Payments Signal editorial teaching models — Payments Signal

    This site's own simplified teaching models. · Checked 2026-07-12

    What this simplifies: Daily List, cast and the three-user/four-task narrative are fictional. The existing three query strings, dates and counts are preserved and independently repeated on SQLite 3.53.1, yielding 2, 3 and 3. The original 3.40.1 statement is historical provenance. The fixed date 2026-11-02 and lower bound 2026-10-26 are worked-case values, not current operating dates or a complete live week query. The separate public ten-task project is untouched.

    Used wherever diagrams, scenarios, figures, or example values are didactic constructions rather than sourced facts; every such use carries a simplifications disclosure. All people, companies, banks, and list entries in examples are fictional.

Deepest material on this page: L4 — Standards & sources. Where a topic stops short of implementation depth, that is a deliberate coverage decision, not an oversight — see coverage.