Text-to-SQL
An AI capability that converts natural language questions into SQL database queries. Instead of writing complex SQL, a user asks 'What are the top 5 products by revenue in EMEA?' and the AI agent generates and executes the correct query. Text-to-SQL powers data agents, business intelligence chatbots, and analytics assistants—making databases accessible to non-technical users who need answers without learning query languages.
Example
A marketing director asks the data agent 'How did our email campaigns perform last quarter compared to the quarter before?' The agent generates a SQL query joining the campaigns and metrics tables, calculates period-over-period changes, and returns a natural language summary with the key numbers.
Frequently asked questions
- How accurate is text-to-SQL?
- On standard benchmarks, frontier models achieve 80-90% accuracy. In production with well-documented schemas and clear column descriptions, accuracy reaches 85-95% for common query patterns. Complex queries with multiple joins, subqueries, or ambiguous column names are where accuracy drops. Best practice: show the generated SQL to power users and allow corrections.