Synthesizing Highly Expressive SQL Queries

A project of Chenglong Wang, Alvin Cheung and Ras Bodik from University of Washington PLSE Group
Star Issue

Scythe is a programming-by-example system that aims to help end-users with database querying tasks. Given a pair of input-output table examples, Scythe synthesizes queries that turn input examples into the provided output example. (Demo)

In the past, when a user want to query a database but don't know how ...

... the user would go to Stack Overflow and write a post and wait for experts ...

Now, use Scythe!

... and the query can be obtained in ease!
(The subset of SQL features supported by Scythe now includes select, join, group by, aggregtion, outer join, exists and subqueries; features that we are currently working on includes column arithmetics, pivoting and window functions .)

Try Scythe!

How does Scythe work?

Scythe is backed by a two-phase search algortihm: given the input-output example, the algorithm will first sketch query skeletons and then infer predicates in them. The two-phase synthesis search algorithm brings Scythe plenty of optimization opportunities to scale up for complex queries. For details, refer to the following papers.


Synthesizing more complex queries (e.g., queries with pivoting, window functions) for data analytic tasks remains a highly challenging task, we would love to collaborate with you to make Scythe better! Drop us a line!