Query Data in Natural Language: A Team Readiness Guide
Prepare your team to query data in natural language: define metrics, choose deployment, verify permissions and test answers with a worked invoice example.

To query data in natural language, a user asks a business question and a connected system translates it into a database query, retrieves permitted data and explains the result. Before non-technical teams use those answers, establish five things: an approved dataset, agreed metric definitions, enforced access, approved AI processing and known-answer tests.
This guide is for the team deciding whether a conversational database workflow is ready for a pilot. It includes an editable readiness worksheet and a small PostgreSQL invoice reference. The reference was executed locally in PGlite; it is synthetic and does not measure an AI system's accuracy or certify a deployment. AskYourDatabase publishes this guide with AI-assisted drafting and local reference checks.
For terminology and everyday question examples, start with the natural language querying overview. For writing a better prompt and preserving context in follow-ups, use the AI database query guide. Here the task is deciding who owns each prerequisite and what evidence is needed before people depend on the answers.
Give business users a defined reporting task
Choose a question that leads to a specific action. “Analyze our finances” has no agreed boundary. “List Company A's overdue USD invoices as of the start of October 7” can have a defined dataset, calculation and expected answer.
A first pilot should make it possible to explain a wrong answer. If the source, metric, reporting period and user population all change simultaneously, the team cannot tell whether a discrepancy came from the model, the data or the question. Start with one reporting domain and add tasks only after its owners can reproduce the results.
| Prerequisite | Accountable owner | Evidence to have before the pilot |
|---|---|---|
| Reporting data | Data owner | Approved tables or views, row grain, join keys and freshness |
| Business meaning | Metric owner | Written formula, dates, units, exclusions and missing-data rules |
| Access | Database and application owners | Allowed identities, rows, columns and operations; denied-access tests |
| AI processing | Deployment owner | Application, model, storage and dependency locations |
| Answer quality | Business reviewer and analyst | Known questions, reference results and a correction path |
| Operations | Application operator | Version, support route, recovery procedure and change review |
The analyst remains responsible for the reusable foundation; the business user gains room to explore within it. Microsoft's managed self-service BI guidance describes a similar division between centrally managed data and business-created analysis. That principle does not imply AskYourDatabase implements Power BI's semantic-model features.
For deciding which requests should become self-service and how to measure adoption, use the company data democratization plan. It includes request routing and a pilot measurement worksheet.
Turn business definitions into a small data contract
A natural-language question is rarely a complete specification. “Overdue” might mean due before today, more than thirty days late, or overdue after a grace period. “Outstanding” may mean original invoice value or the balance after payments and credits. A plausible interpretation can still be the wrong business answer.
For the fictional invoice pilot, agree these rules:
| Rule | Approved definition |
|---|---|
| Grain | One row per invoice; payment amounts already aggregated per invoice |
| Scope | Company A and USD only |
| Snapshot | Start of October 7, 2026, using date-only due dates |
| Overdue | Due date strictly earlier than October 7 |
| Outstanding | Invoice amount minus payments recorded in this snapshot |
| Eligible status | Open invoices with a positive remaining balance |
| Missing due date | Exclude from overdue totals and flag for separate investigation |
| Display | Invoice ID and outstanding cents; no customer names or contact details |
If the raw source stores one row per payment, aggregate those payments before joining to invoices. Otherwise the invoice value can repeat. If invoice IDs are only unique inside a company, include the company key in the relationship. This example uses globally unique invoice IDs to keep the fixture small.
The snapshot matters too: today's payment balance cannot reconstruct an earlier overdue balance without payment history. Do not label a current-state report “as of last month” merely by changing the due-date cutoff. If your sources use timestamps, define their business timezone and cutoff consistently before adapting the date-only example.
Use schema comments, documentation and reviewed SQL examples to supply these meanings to the configured product. Treat them as maintained reference material. A correction made in one conversation is not proof of automatic, permanent learning across all users.
Decide where the application, query and model run
The phrase “local AI” can refer to several different locations. Map them separately rather than relying on a product label.
| Workflow | Database connection and execution | Model processing to verify | Suitable evaluation starting point |
|---|---|---|---|
| Desktop analysis | Connection from the user's computer | Standard AI workflow can use external AI services | An individual working with an approved datasource |
| Hosted Website Chatbot | Hosted services connect to the permitted database | Configured model provider and stored conversation/tool content | Authenticated team or customer-facing chat |
| Private application | Application runs in your infrastructure | External API or a separately agreed self-hosted model | Enterprise hosting or network requirements |
A local database connection does not mean the schema, question or selected result values remain local. A private application may call a remote model. Follow-up analysis can add data to a later model request even when the initial question contains none.
Draw a simple processing map covering the database, application, inference endpoint, conversation history, logs, exports and backups. Add authentication, licensing, updates and optional analysis services. For each connection, record the data categories permitted to cross it and who can inspect the configuration. If restricted-network operation is required, test every required workflow under that restriction.
The private deployment documentation covers application sizing and deployment evaluation. Application server requirements are not language-model hardware requirements. Agree the model, endpoint and feature support before budgeting self-hosted inference; this article does not promise model parity, a turnkey air-gapped package or a fixed response time. Review the security and data-flow guide for storage and transport boundaries.
Enforce access outside the conversation
Separate three questions: can this identity open a session, which data can that session read, and which database operations can the execution account perform? Passing one check does not answer the others.
A read-only account may still read every customer row. A prompt saying “show only Company A” is not authorization. PostgreSQL's privilege documentation distinguishes permissions such as SELECT, INSERT, UPDATE and DELETE; the privileges granted to the actual execution role determine what it may do at the database layer.
For a pilot, have the database owner expose only the approved reporting surface and grant the required privileges. Verify effective access, including inherited roles, views and any callable functions relevant to the workload. Avoid treating a read-only UI switch as proof that every underlying route is restricted.
For customer-facing chat, configure table and row access controls and test the actual authenticated session path. Identity must come from your trusted backend, not a company ID typed into a prompt or accepted unchecked from the browser. The embedded chatbot implementation guide explains that integration boundary.
Use separate test identities for Company A and Company B. Test allowed reads, requests for the other company's records, omitted identity, follow-ups and attempted writes against disposable data. An AI refusal alone is not sufficient evidence: retain the actual database or application denial. Our invoice SQL below uses a company filter to make the calculation reproducible; it does not implement tenant authorization.
Check one answer before testing a conversation
The reference dataset deliberately includes partial payments, an invoice due on the cutoff, a fully paid invoice, a missing due date, another company and another currency.
| Invoice | Company / currency | Due date | Amount / paid, cents | Status | In the overdue answer? |
|---|---|---|---|---|---|
| I1 | A / USD | September 30 | 10000 / 2500 | Open | Yes: 7500 cents |
| I2 | A / USD | October 7 | 5000 / 0 | Open | No: due on cutoff |
| I3 | A / USD | September 1 | 4000 / 4000 | Closed | No: fully paid |
| I4 | A / USD | Missing | 3000 / 0 | Open | Unknown due date; investigate |
| I5 | B / USD | September 20 | 9000 / 0 | Open | No: another company |
| I6 | A / EUR | September 20 | 6000 / 0 | Open | No: another currency |
| I7 | A / USD | September 25 | 2000 / 500 | Open | Yes: 1500 cents |
The approved question is:
List Company A's open USD invoices due before October 7, 2026, with a positive balance. Use the payment balances at the start of that date. Show invoice ID and outstanding cents. Exclude missing due dates from overdue totals and identify them separately.
The reference query for the overdue list is:
SELECT invoice_id, amount_cents - paid_cents AS outstanding_cents
FROM rollout_invoices
WHERE company_id = 'A' AND currency = 'USD'
AND status = 'open' AND due_on < DATE '2026-10-07'
AND amount_cents > paid_cents
ORDER BY invoice_id;
It returns I1 = 7500 cents and I7 = 1500 cents, for 9000 cents ($90) across two invoices. I4 must be raised separately as a missing-date issue; zero overdue value must not be interpreted as proof that all records are complete. The download's comments state this boundary explicitly.
Run the complete fixture and query only in a disposable PostgreSQL test session. It uses temporary tables that belong to that session. It is not an automatic AskYourDatabase import; a connected evaluation needs a persistent approved test datasource prepared by its owner.
Our local PGlite checks verified the reference and changes to the cutoff, company, currency, payment balance and missing date. They test editorial SQL, not generated product answers or deployed access controls. For a broader numerical evaluation, use the text-to-SQL acceptance kit.
Test follow-ups, denials and uncertainty separately
A team rollout needs more than one correct total. Copy these cases into the worksheet and retain an actual result for each one. The expected behavior below is a proposed acceptance condition; it is not a claim that a product has passed it.
| Case | Request or change | Expected result or evidence |
|---|---|---|
| Known answer | Run the approved overdue question | I1 and I7; 9000 cents total |
| Cutoff boundary | Include invoices due on October 7 | I2 joins the list; total becomes 14000 cents |
| Follow-up | Show only balances above 2000 cents | I1 only; retain Company A, USD and the original cutoff |
| Ambiguity | Show our worst accounts | Ask for the definition, metric and scope before treating the result as approved |
| Data quality | Are there invoices without due dates? | I4 is a separate completeness issue in the approved A/USD scope |
| Authorization | Request Company B using Company A's real test identity | Enforced denial or scoped result, independent of prompt wording |
| Write boundary | Attempt an update using the reporting execution role | Database-side denial in an authorized disposable environment |
| Failure handling | Make the model or reporting source unavailable in staging | Clear failure rather than a fabricated number; operator can diagnose it |
Keep two scores separate: numerical correctness and enforced authorization. Do not average an unauthorized disclosure into an acceptable overall accuracy percentage. Likewise, a permitted query that returns the wrong value is still an analytical failure. Record unresolved cases with an owner and retest after changes to the schema, definitions, model or access configuration.
Run an AskYourDatabase pilot with the worksheet
Start with an approved test datasource and the product path that fits your audience. Follow the connection guide, supply the reviewed definitions through the available training controls, and ask the reference question before expanding to open-ended exploration.
AskYourDatabase training interface. The screenshot illustrates product configuration; it is not evidence that the invoice fixture was run through the product.
Review generated SQL and results using the available product or administrative tooling. Some embedded end-user interfaces may hide SQL, so assign query review to the person who can inspect that execution path. Then have a business reviewer confirm that the answer supports the intended decision and describes its scope and freshness accurately.
Give pilot users three habits: state the business scope, challenge an unclear definition, and escalate a suspicious result. A chart or confident explanation should not remove the need to verify a newly introduced metric. Use the SQL dashboard guide when an approved question needs a repeatable shared display; report scheduling and delivery are separate capabilities to verify.
Measure time to a reviewed answer, correction rate and unresolved failures against your previous workflow. Count the time spent reviewing and maintaining definitions as well as time spent asking questions. Do not infer hours saved, adoption or business impact from a successful demo.
For individual evaluation, use the Desktop download and setup path. Compare Desktop, Website Chatbot and Enterprise plans for the intended audience. For a private deployment, bring a redacted processing map, required workflows and the worksheet to an Enterprise discussion, without production credentials or customer records. Expand the rollout only within the configuration and tasks that your team has actually approved.
Frequently asked questions
What must be in place before non-technical teams query data in natural language?
Start with an approved reporting dataset, a named metric owner, clear business definitions, limited database permissions, approved model processing, and known-answer tests. Users also need a way to report an uncertain or incorrect answer before it is used for a decision.
Does natural language querying remove the need for a data team?
No. Business users can ask questions without writing every query, but data owners still maintain source quality, definitions, permissions, reference answers and escalation. A conversational interface does not automatically resolve conflicting business rules.
Does on-premise deployment keep all data inside our network?
Not automatically. Application hosting, database execution and model inference are separate locations. A private application can call an external AI service, and selected schema, conversation or result data can leave the network. Verify the exact deployment and every required dependency.
Is a read-only account enough to protect customer data?
No. Read-only privileges restrict writes but can still expose every readable row or column. Configure permitted data and user authorization separately, then test the actual session and database execution path with disposable data.
How should we validate natural language query results?
Use questions with approved definitions and known results. Check SQL, row scope, dates, currencies, partial payments, missing values and follow-up behavior. Keep authorization failures separate from numerical correctness, and retest after relevant configuration changes.
Does this guide demonstrate AskYourDatabase accuracy?
No. The invoice example is synthetic reference SQL executed locally in PGlite. It is a starting point for your evaluation, not an AI-generated answer, product benchmark, security certification or promise about production performance.
