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

10/12/2020
by   Keita Takenouchi, et al.
0

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 https://naist-se.github.io/patsql/ .

READ FULL TEXT

page 1

page 2

page 3

page 4

research
03/16/2022

Translating Canonical SQL to Imperative Code in Coq

SQL is by far the most widely used and implemented query language. Yet, ...
research
07/16/2023

Programming by Example Made Easy

Programming by example (PBE) is an emerging programming paradigm that au...
research
03/16/2020

Duoquest: A Dual-Specification System for Expressive SQL Queries

Querying a relational database is difficult because it requires users to...
research
05/29/2018

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...
research
04/14/2022

Synthesizing Analytical SQL Queries from Computation Demonstration

Analytical SQL is widely used in modern database applications and data a...
research
11/14/2017

DataVizard: Recommending Visual Presentations for Structured Data

Selecting the appropriate visual presentation of the data such that it p...
research
04/17/2019

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