PATSQL: Efficient Synthesis of SQL Queries from Example Tables with Quick Inference of Projected Columns

by   Keita Takenouchi, et al.

SQL is one of the most popular tools for data analysis and used by an increasing number of users without having expertise in databases. In order to help such non-experts to write correct SQL queries, several studies have proposed programming-by-example approaches. In these approaches, the user can obtain a desired query just by giving input and output (I/O) tables as an example. 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 I/O tables increases. In this paper, we propose an efficient algorithm that synthesizes SQL queries from I/O tables. Specifically, it has strengths in both the execution time and the scale of supported tables. We adopt a sketch-based synthesis algorithm and focus on the quick inference of the columns used in the projection operator. In particular, we restrict the structures of sketches based on transformation rules in relational algebra and propagate a novel form of constraint using the output table in a top-down manner. We implemented this algorithm in our tool PATSQL and evaluated it on 118 queries from prior benchmarks and Kaggle's tutorials. As a result, PATSQL solved 72 within a second. Our tool is available at .


page 1

page 2

page 3

page 4


Translating Canonical SQL to Imperative Code in Coq

SQL is by far the most widely used and implemented query language. Yet, ...

Programming by Example Made Easy

Programming by example (PBE) is an emerging programming paradigm that au...

Duoquest: A Dual-Specification System for Expressive SQL Queries

Querying a relational database is difficult because it requires users to...

You Say 'What', I Hear 'Where' and 'Why' --- (Mis-)Interpreting SQL to Derive Fine-Grained Provenance

SQL declaratively specifies what (not how) the desired output of a query...

Synthesizing Analytical SQL Queries from Computation Demonstration

Analytical SQL is widely used in modern database applications and data a...

DataVizard: Recommending Visual Presentations for Structured Data

Selecting the appropriate visual presentation of the data such that it p...

Estimating Cardinalities with Deep Sketches

We introduce Deep Sketches, which are compact models of databases that a...

Please sign up or login with your details

Forgot password? Click here to reset