Text-to-SQL and LLMs over structured data
- System design
- Specialist topic or differentiator
- About 2 h to learn
- 3 vetted resources
What this topic covers
“Let people ask questions of our warehouse in plain English” is one of the most common enterprise LLM projects, and “design a text-to-SQL system over thousands of tables” is a recurring design prompt. The hard parts aren’t generating SQL; they’re finding the right tables and columns, knowing what the business means by a term, and catching wrong-but-valid queries. A strong answer covers schema and example retrieval, intent routing and column pruning for large schemas, asking clarifying questions, validating with parsing and dry runs before execution, read-only permissions, and an eval set scored on execution results rather than string match.
You’re ready when you can
What interviewers check, from the resources below.
- Explain why intent routing to workspaces came before table retrieval
- Explain how column pruning keeps large schemas inside the context window
- Describe how Uber built and scored its evaluation set
- Say why the bar for LLM-written SQL is higher than for a chat answer
- Explain why fine-tuning is a poor fit for per-database business knowledge
- Describe a validate-then-reprompt loop using a parser and dry run
- Explain when the system should ask a clarifying question instead of guessing
- Explain what makes enterprise text-to-SQL harder than Spider 1.0 or BIRD
- Explain why execution-based scoring beats string match for SQL
- Name the most common failure types the authors found
What to study, in order
Each link opened and checked by hand; the date says when.
Start here
QueryGPT – Natural Language to SQL Using Generative AI (opens in a new tab)
Uber Engineering · Jeffrey Johnson et al. · 30 min · Free · checked 22 Oct 2026
- Why
- A real text-to-SQL system over a very large warehouse, with the version history that shows why naive “retrieve tables, generate SQL” failed. It maps neatly onto a 45-minute design answer.
- What to read
- Read “Architecture” (Hackdayz v1, Better RAG, Understanding User’s Intent, Handling Large Schemas), then “Current Design” with the intent, table and column-prune agents, “Evaluation” and “Learnings”.
- What to skip
- Skip “Motivation” and the acknowledgements.
Free alternative
Getting AI to write good SQL: Text-to-SQL techniques explained (opens in a new tab)
Google Cloud Blog · Per Jacobsson · 20 min · Free · checked 22 Oct 2026
- Why
- A compact list of the techniques production text-to-SQL agents use, from context retrieval to validation loops, written by an engineer who builds them.
- What to read
- Read “The challenges of text-to-SQL technology” (business context, user intent, limits of generation), then each technique: SQL-aware models, disambiguation, retrieval and in-context learning, validation and reprompting, self-consistency. Finish with “Evaluation and measuring improvements”.
- What to skip
- Nothing to skip; it’s short.
Go deeper
Spider 2.0: Evaluating Language Models on Real-World Enterprise Text-to-SQL Workflows (opens in a new tab)
arXiv · Fangyu Lei et al. · 45 min · Free · checked 22 Oct 2026
- Why
- The benchmark that shows why academic text-to-SQL scores don’t carry over to real warehouses with thousands of columns and several SQL dialects. Handy when an interviewer asks how you’d evaluate.
- What to read
- Read §1 Introduction, §2.1 Task Definition, §3.2 Evaluation Results and §4.2 Error Analysis of SQL Generation. Compare the gap between Spider 1.0, BIRD and Spider 2.0 results.
- What to skip
- Skip §2.2–2.3 (annotation pipeline and statistics), related work and the appendices.
Companies that test System design most
Put Text-to-SQL and LLMs over structured data in your plan
Tell us your interview date and hours a day; it lands on the right day, in the right order.