PATSQL: Efficient Synthesis of SQL Queries from Example Tables with Quick Inference of Projected Columns
Not on the map. Why?
Abstract (arXiv)
SQL is one of the most popular tools for data analysis, and it is now used by an increasing number of users without having expertise in databases. Several studies have proposed programming-by-example approaches to help such non-experts to write correct SQL queries. While existing methods support a variety of SQL features such as aggregation and nested query, they suffer a significant increase in computational cost as the scale of example tables increases. In this paper, we propose an efficient algorithm utilizing properties known in relational algebra to synthesize SQL queries from input and output tables. Our key insight is that a projection operator in a program sketch can be lifted above other operators by applying transformation rules in relational algebra, while preserving the semantics of the program. This enables a quick inference of appropriate columns in the projection operator, which is an essential component in synthesis but causes combinatorial explosions in prior work. We also introduce a novel form of constraints and its top-down propagation mechanism for efficient sketch completion. We implemented this algorithm in our tool PATSQL and evaluated it on 226 queries from prior benchmarks and Kaggle's tutorials. As a result, PATSQL solved 68% of the benchmarks and found 89% of the solutions within a second. Our tool is available at https://naist-se.github.io/patsql/.
Key facts. Cited by 4 papers in the map (data through 7 Oct 2026). First posted on arXiv 12 Oct 2020.
Builds on
No reference list yet.
Built on by
Citing papers per year: 2022: 1; 2023: 1; 2024: 0; 2025: 2.
4 papers.
- 2023Auto-Tables: Synthesizing Multi-Step Transformations to Relationalize Tables without Using Examplescited by 15
- 2025Tabular Embeddings for Tables with Bi-Dimensional Hierarchical Metadata and Nestingcited by 1
- 2022NP4G : Network Programming for Generalizationcited by 0
- 2025Xpose: Bi-directional Engineering for Hidden Query Extractioncited by 0
- 2025Xpose: Bi-directional Engineering for Hidden Query Extraction15 Apr 2025
- 2025Tabular Embeddings for Tables with Bi-Dimensional Hierarchical Metadata and Nesting20 Feb 2025
- 2023Auto-Tables: Synthesizing Multi-Step Transformations to Relationalize Tables without Using Examples27 Jul 2023
- 2022NP4G : Network Programming for Generalization8 Dec 2022