Text-to-SQL: Query Your Data in Plain Language

Text-to-SQL: Query Your Data in Plain Language

Key answer

Text-to-SQL turns a plain-language question into a SQL query against your schema, run over a governed, read-only data layer. AI writes the query and explains it; you confirm the logic and the result. It widens who can ask questions of data without widening who can break it.

Text-to-SQL turns a plain-language question into a SQL query against your schema, run over a governed, read-only data layer. AI writes the query and explains it; you confirm the logic and the result. It widens who can ask questions of data without widening who can break it, which is the whole point of doing it safely.

See a question become a query#

Type a business question, get the query it produces. AI writes; you confirm.

Plain-language question to SQL, live

Business question What the SQL returns
Top 5 products by revenue last quarter SELECT … ORDER BY revenue DESC LIMIT 5
Monthly active customers this year COUNT(DISTINCT customer) GROUP BY month
Refund rate by region SUM(refunds)/SUM(orders) GROUP BY region
Churned customers last 90 days WHERE last_order < now() – 90d
AI drafts each category; you review and lock.
Press Run to turn each business question into the query it produces. AI writes; you confirm.

The value is access: a manager can ask ‘refund rate by region’ and get an answer in seconds, with the SQL shown so an analyst can check it. The question-asking widens; the query-writing burden shrinks.

Why routine querying is automating#

of descriptive and diagnostic analytics will be automated by 2027, routine querying included

90% of descriptive and diagnostic analyticswill be automated by 2027, routine Gartner, Autonomous Finance

Gartner expects 90% of descriptive and diagnostic analytics to be automated by 2027, and routine querying is squarely in that. But strong is not flawless: on the BIRD benchmark, the best single model reached about 80% execution accuracy in June 2026, against a human-expert baseline near 93%, so roughly one query in five can still be wrong. That is exactly why the generated SQL is shown for review, never trusted blind. Analysts move from writing queries to reviewing them and doing the harder modelling. The trusted data layer this runs over starts with Auto-EDA and data-quality scoring.

AI text-to-SQL vs human accuracy (BIRD)

Best single AI model (execution accuracy)80%Human expert baseline93%

Strong, not flawless: at ~80%, about 1 in 5 queries can be wrong, which is why the SQL is shown for review. Source: Google Research on BIRD, June 2026.

The guardrails that keep it safe#

The guardrails that keep it safe

Read-onlyQueries cannot change the data.Schema-awareGrounded in your real tables.ExplainedThe SQL is shown for review.LoggedEvery query recorded andauditable.

Plain-language access without plain-language risk.

Read-only, schema-aware, explained, and logged. These four controls are what let you open data access without opening data risk, the same governance posture as the executive operating model.

Ticket queue vs self-serve#

Ticket queue vs self-serve

SQL ticket queueOnly analysts can askDays of backlogRe-written each timeBusiness waitsGoverned text-to-SQLThe business asks directlyAnswer in secondsReusable query libraryAnalysts do harder work

Who can ask, and how fast.

The shift is from an analyst-only ticket queue to governed self-serve: the business asks directly, analysts do harder work, and every query is logged. Access widens; control holds.

Build a governed text-to-SQL layer#

Practical GenAI in Data Analytics ships a text-to-SQL library over a governed read-only layer in Session 2. You leave able to let the business ask, safely.

Key takeaways

  • Text-to-SQL turns a plain-language question into a query against your schema.
  • Run it over a governed, read-only layer so access widens but risk does not.
  • AI writes and explains the SQL; the analyst confirms logic and result.
  • Log every query; show the SQL so the answer can be checked.

Questions, answered

What is text-to-SQL?
Text-to-SQL is AI that converts a plain-language question, such as 'top five products by revenue last quarter', into a SQL query against your database schema, then runs it. It lets non-analysts ask data questions directly, while the analyst reviews the generated SQL and the result for correctness.
Is it safe to let the business write queries this way?
Yes, with guardrails. Run text-to-SQL over a governed, read-only data layer so queries can never change data, ground it in your real schema, show the generated SQL for review, and log every query. Those four controls give plain-language access without plain-language risk.
Does text-to-SQL always get the query right?
No, which is why the SQL is shown, not hidden. It is strong on routine questions and weaker on ambiguous ones or complex joins. The analyst confirms the logic, especially for anything a leader will act on. Treat the generated query as a fast first draft to verify, not a black box.
How accurate is AI text-to-SQL today?
Strong but not perfect. On the BIRD benchmark, the best single AI model reached about 80% execution accuracy in June 2026, against a human-expert baseline near 93%. Execution accuracy means the generated SQL must actually run and return the same rows as the correct query, not merely look valid. At 80%, roughly one query in five can still be wrong, which is why the SQL is shown for review rather than trusted blindly.
Does this make SQL skills obsolete?
No. It removes routine query-writing and moves analysts to harder work: modelling, complex joins, and judging whether an answer is right. Understanding SQL becomes more valuable for review, not less, because someone has to confirm the generated query does what the question intended.
AE

Dr. Ahmed El-Shamy

Co-founder, CEO and Dean of Education, Digisoul

Dr. Ahmed El-Shamy is Co-founder, CEO and Dean of Education at Digisoul. He has more than a decade across AI, fraud risk, and FP&A, and teaches Practical GenAI in FP&A bilingually across MENA, the GCC, and Africa, governed by Digisoul's ISO/IEC 42001:2023-certified AI Management System. Read the leadership profile.

Sources

  1. Gartner · by 2027, 90% of descriptive and diagnostic analytics in finance will be automated (2023 prediction). https://www.gartner.com/en/newsroom/press-releases/2023-03-01-gartner-preditcts-three-ways-autonomous-technologies-will-impact-the-fpanda-and-controller-functions-in-
  2. Google Research, via MarkTechPost · text-to-SQL best single model 80.04% vs 92.96% human on BIRD (Jun 2026). https://www.marktechpost.com/2026/06/12/google-releases-gemini-sql2-gemini-3-1-pro-text-to-sql-scores-80-04-on-bird-single-model-leaderboard/
  3. Practical GenAI in Data Analytics (Session 2: text-to-SQL library). https://digisoul.io/ai4x/genai-in-data-analytics/

AI Agent · Built on Claude · Operated on Zoho One


What do you think?

From our blog

Articles & insights

Turn one analysis into three audience-tuned narratives with AI, board, manager, and analyst, in two languages, while you own the facts and the framing.
Forecast a metric with a confidence band and flag anomalies automatically with AI. A practical 2026 method for analysts, with a human owning the judgement.
Profile any dataset in minutes with AI-driven Auto-EDA and a data-quality scorecard, so you trust the data before you analyse it. A practical 2026 method.