kirancodes.me
To Proof Maintenance & Beyond!

Automatically synthesizing SQL queries from input-output examples

Sai Zhang, Yuyin Sun

Abstract

Many computer end-users, such as research scientists and business analysts, need to frequently query a database, yet lack enough programming knowledge to write a correct SQL query. To alleviate this problem, we present a programming by example technique (and its tool implementation, called SQLSynthesizer) to help end-users automate such query tasks. SQLSynthesizer takes from users an example input and output of how the database should be queried, and then synthesizes a SQL query that reproduces the example output from the example input. If the synthesized SQL query is applied to another, potentially larger, database with a similar schema, the synthesized SQL query produces a corresponding result that is similar to the example output. We evaluated SQLSynthesizer on 23 exercises from a classic database textbook and 5 forum questions about writing SQL queries. SQLSynthesizer synthesized correct answers for 15 textbook exercises and all 5 forum questions, and it did so from relatively small examples.

BibTeX
@inproceedings{Zhang-Sun:ASE13,
  author    = {Sai Zhang and
               Yuyin Sun},
  title     = {Automatically synthesizing {SQL} queries from input-output examples},
  booktitle = {ASE},
  pages     = {224--234},
  publisher = {{IEEE}},
  year      = {2013},
}

Related papers