Source-linked AI summary
Recent Advances in Text-to-SQL: A Survey of What We Have and What We Expect
Naihao Deng, Yulong Chen, Yue Zhang
TL;DR
Text-to-SQL connects natural-language requests to database queries, but the literature lacks a comprehensive survey of its challenges and progress. This paper systematically reviews datasets, methods, and evaluation, and synthesizes future directions for the field.
Problem
Text-to-SQL research spans encoding, translating, and decoding challenges, but prior surveys cover a limited scope and comprehensive coverage remains lacking.
Source: §1 · p. 1Method
The paper systematically surveys recent text-to-SQL progress across datasets, methods, and evaluation, and discusses potential future directions.
Source: §1 · pp. 1–2Results
The survey reviews methods addressing the task’s challenges to different extents and synthesizes progress across datasets, methods, and evaluation.
Source: §1 · pp. 1–2Takeaways & Limitations
The survey identifies potential future directions for text-to-SQL research.
Source: §1 · p. 2Intermediate representations are usually dataset-specific and cannot be easily adapted to other datasets.
Source: §3.3 · p. 6
Abstract
from arXiv · showhide
Text-to-SQL has attracted attention from both the natural language processing and database communities because of its ability to convert the semantics in natural language into SQL queries and its practical application in building natural language interfaces to database systems. The major challenges in text-to-SQL lie in encoding the meaning of natural utterances, decoding to SQL queries, and translating the semantics between these two forms. These challenges have been addressed to different extents by the recent advances. However, there is still a lack of comprehensive surveys for this task. To this end, we review recent progress on text-to-SQL for datasets, methods, and evaluation and provide this systematic survey, addressing the aforementioned challenges and discussing potential future directions. We hope that this survey can serve as quick access to existing work and motivate future research.
1 Introduction
Text-to-SQL converts natural-language utterances into SQL, supporting natural-language access to databases. This survey addresses a gap in comprehensive coverage by reviewing recent work on datasets, methods, evaluation, and future directions.
1 Introduction
- Text-to-SQL converts natural utterances into SQL queries, providing a natural-language interface that helps lay users access database information.The survey also identifies it as a representative semantic-parsing task with downstream applications such as question answering.Source: §1 · p. 1
- The task involves encoding utterance meaning, translating it into a pragmatically equivalent expression, and decoding the corresponding SQL query.The survey notes that prior surveys covered a limited scope, motivating a broader systematic review.Source: §1 · p. 1
- The survey reviews recent progress on text-to-SQL datasets, methods, and evaluation, and highlights potential future directions.It aims to address the task’s encoding, translating, and decoding challenges.Source: §1 · pp. 1–2
2 Datasets
Text-to-SQL datasets range from single-database collections to large cross-domain and specialized resources. Their settings shape what kinds of generalization or interaction they can evaluate.
2 Datasets
- Existing text-to-SQL datasets fall into single-domain, cross-domain, and other categories.The survey’s dataset table distinguishes cross-domain datasets from single-domain datasets.Source: §2 · p. 2
- Single-domain datasets often contain only hundreds to thousands of examples, and similar train-test SQL patterns can let models memorize patterns rather than generalize.These datasets can nevertheless include real-world domain knowledge and conventions relevant to evaluating domain generalization.Source: §2 · p. 2
- WikiSQL contains 80,654 natural utterances, but its queries are simple and each SQL query covers only one table.The dataset uses tables extracted from Wikipedia and questions paraphrased from questions generated for those tables.Source: §2 · p. 2
- Spider contains 200 databases averaging five tables each and tests performance on complicated unseen SQL queries and generalization to new domains.Spider-based datasets have also been annotated in Chinese, Vietnamese, and Portuguese for potential multilingual research.Source: §2 · pp. 2–3
- Other resources cover context-dependent interaction, answerability, lexicon-level mapping, and cross-domain evaluation on real Web databases.The survey includes English and Chinese interaction datasets.Source: §2 · p. 3
3 Methods
The survey organizes deep-learning text-to-SQL methods around data augmentation, encoding, decoding, learning techniques, and miscellaneous approaches. Across these areas, methods address question meaning, schema structure, SQL generation, and training or deployment settings.
3 Methods
- The survey focuses primarily on deep-learning methods, grouping them into five categories and other technologies.It contrasts these with earlier rule- and template-based systems suited to simple queries and databases.Source: §3 · p. 3, §3.3 · p. 5
3.1 Data Augmentation
- Data augmentation spans paraphrases, templates, and generated questions, but low-quality augmented data can hurt model performance.Filtering generated examples by whether a parser recovers the sampled SQL and composing questions from clause-level subquestions are approaches to improving quality.Source: §3.1 · p. 3
3.2 Encoding
- Encoding methods represent questions and schemas using pretrained models, graph structures, and self-attention that can incorporate relations among tables and columns.Graph approaches can also encode question-schema links, while some pretraining objectives use tabular data or synthesized question-SQL pairs.Source: §3.2 · pp. 4–5
3.3 Decoding
- Decoding methods use intermediate representations, tree or sketch structures, attention, copying, and constrained or execution-guided search to generate SQL.Intermediate representations are often dataset-specific and not easily adapted to other datasets.Source: §3.3 · pp. 5–6
3.4 Learning Techniques
- Learning techniques include active, interactive, imitation, meta-, multi-task, and reinforcement learning, as well as weak supervision.Some multi-task approaches use related semantic-parsing tasks, which the survey says improve text-to-SQL performance.Source: §3.4 · p. 7
3.5 Miscellaneous
- Miscellaneous approaches address database linking, model design, SQL generation, and context-dependent text-to-SQL settings.Examples include linking mentioned cell values to fields, hybrid grammar-and-T5 generation, and turn-level encoders or dynamic memory.Source: §3.5 · p. 7
4 Evaluation
Text-to-SQL evaluation uses automatic metrics and dataset splits to assess query correctness and generalization. The survey highlights that common metrics can misjudge semantically equivalent or different queries.
4 Evaluation
- Execution accuracy can yield false positives for semantically different queries, while exact string match can be too strict for semantically equivalent SQL.Spider uses exact set match, comparing SQL sub-clauses; another approach generates databases designed to distinguish predicted and gold queries.Source: §4 · pp. 7–8
- Evaluation splits range from random question-SQL pair splits to SQL-query splits and database splits designed to test generalization to unseen queries or databases.Other split methods are also used for different research topics.Source: §4 · p. 8
5 Discussion and Future Directions
Despite rising performance on WikiSQL and Spider, text-to-SQL still faces cross-domain and real-world robustness challenges. The survey points to future work in user-centered settings, broader semantic parsing connections, prompt learning, and evaluation.
5 Discussion and Future Directions
- Models can lose performance across text-to-SQL datasets from other domains, while Spider question-SQL pairs omit domain knowledge, ambiguity, and domain convention.The survey calls for cross-domain systems that handle similar information stored under slightly different database schemas.Source: §5 · p. 8
- Real-world systems must handle varied settings and user requests, motivating more user studies, multilingual text-to-SQL, and support for people with disabilities.Examples include corrupted or absent tables, nonstandard input, and speech-to-SQL for visually impaired users.Source: §5 · p. 8
- Text-to-SQL may connect database applications such as question answering and task-oriented dialogue with broader semantic parsing research on logical forms.The survey also suggests database querying for fact-checking and studying relations among logical forms.Source: §5 · pp. 8–9
- Prompt learning suits low-resource settings, but its robustness can suffer and its performance can depend on selected data, misaligning it with cross-domain deployment needs.The survey calls for studying prompt learning in real-world text-to-SQL alongside cross-domain challenges.Source: §5 · p. 9
- Evaluation can extend beyond dataset performance to human time saved and interactive setups for context-dependent text-to-SQL tasks.The cited examples measure time to retrieve information in operational systems.Source: §5 · p. 9
A Topology for Text-to-SQL
- Figure 5 presents the topology for the text-to-SQL task.Source: A Topology for Text-to-SQL · p. 17
B.1 Table and Database
The appendix illustrates database and domain context with examples from Restaurants and Advising. It notes that databases vary in table count and that utterances can rely on domain knowledge.
B.1 Table and Database
- The Restaurants dataset covers restaurant information, with questions typically about food type and location.Source: §B.1 · p. 17
- Restaurants has 3 tables, compared with 32 tables in ATIS, illustrating substantial variation in database size.Source: §B.1 · p. 17
B.2 Domain Knowledge
- In Advising, “581” means course number 581 in the EECS department, so interpreting the utterance depends on domain knowledge.Source: §B.2 · p. 17
B.3 Dataset Convention
The appendix gives examples of dataset conventions and templated question-SQL pairs, then discusses complexity in SQL queries and natural utterances.
B.3 Dataset Convention
- In the Restaurants dataset, a query for “restaurants” returns the HOUSE_NUMBER and NAME columns by convention.Source: §B.3 · p. 17
B.4 Text-to-SQL Templates
- Text-to-SQL templates populate slots with database table and column names and join corresponding tables to form SQL queries.One example pairs a question template with an SQL template.Source: §B.4 · pp. 17–18
B.5 Complexity of Natural Language and SQL Query Pairs
- SQL query hardness can be described by the number of SQL components; queries with more keywords such as GROUP BY and nested subqueries are harder.Prior work reports better model performance on shorter than longer SQL queries.Source: §B.5 · p. 19
- Natural-utterance complexity lacks a qualitative measure; length, ambiguity, and domain-specific phrases offer different considerations.Longer questions may reduce performance, while conveying more complete information than shorter questions.Source: §B.5 · p. 19
C Text-to-SQL Datasets
The appendix points to a table of text-to-SQL dataset statistics.
- Table 7 lists statistics for text-to-SQL datasets.Source: C Text-to-SQL Datasets · p. 19
C.1 More Discussion on Text-to-SQL Datasets
The survey describes multilingual and cross-domain dataset extensions, multi-turn dialogue benchmarks, and a benchmark that includes unanswerable questions. CoSQL adds dialogue tasks beyond generating SQL from user utterances.
- CSpider, ViText2SQL, and José and Cozman translate Spider’s English questions into Chinese, Vietnamese, and Portuguese, respectively.Source: §C.1 · p. 19
- TableQA and DuSQL collect Chinese utterance–SQL pairs across domains, following WikiSQL and Spider collection methods, respectively.Source: §C.1 · p. 19
- Unlike ATIS and Sparc, which omit system responses and assume questions map to SQL, CoSQL includes SQL-grounded dialogue state tracking, response generation, and dialogue-act prediction.Source: §C.1 · p. 19
- TriageSQL adds unanswerable questions to Spider and WikiSQL, raising the challenge of distinguishing answerable from unanswerable questions.Source: §C.1 · p. 19
D Encoding and Decoding Method
Tables 8 and 9 present the text-to-SQL encoding and decoding methods discussed in Sections 3.2 and 3.3, respectively.
- Tables 8 and 9 organize the encoding and decoding methods discussed in Sections 3.2 and 3.3, respectively.Source: D Encoding and Decoding Method · p. 19
E Other Related Tasks
Related tasks take natural-language queries as input and produce other logical forms; text-to-SPARQL is closest to text-to-SQL because both outputs execute on databases. The survey also presents dataset and encoding/decoding method summaries.
- Text-to-Python, text-to-shell or Bash script, text-to-regex, and text-to-SPARQL map natural-language queries to different logical forms.Source: E Other Related Tasks · p. 19
- Text-to-SPARQL is closest to text-to-SQL because both SPARQL and SQL can execute on database systems.Source: E Other Related Tasks · pp. 19–20
- Table 7 summarizes text-to-SQL datasets using question–SQL pair size, database count, domain count, and tables per domain; datasets above and below the line are cross-domain and single-domain, respectively.Source: Table 7 · p. 20
- End-to-end models that take user queries and output logical forms can apply to both text-to-SQL and text-to-SPARQL, while SQL-specific methods require modification for SPARQL.Source: E Other Related Tasks · p. 20
- Tables 8 and 9 summarize methods used for text-to-SQL encoding and decoding, respectively.Source: Table 8 · p. 21, Table 9 · p. 22