Text-to-SQL (Natural Language Querying)

Concept

Text-to-SQL is the AI capability of translating everyday conversational questions into executable, accurate database queries.

Layman Explanation & Analogy

Text-to-SQL lets you ask your database questions in plain English, like "What was our blended ROAS last week by country?", and the AI automatically writes the necessary SQL code to fetch the answer from your CRM or warehouse.

Worked real-world example

Prompt: "Show monthly active users for Q2" → Generated SQL: `SELECT DATE_TRUNC(created_at, MONTH) as month, COUNT(DISTINCT user_id) FROM events WHERE ... GROUP BY 1`.

What people get wrong & common traps

A generated SQL query can run without any error messages and still answer the wrong question (e.g. accidentally double-counting refunded orders or joining on non-unique keys). Always verify the underlying query logic, not just the final number.

Last reviewed August 28, 2026.