【24h】

SqlSol: An accurate SQL Query Synthesizer

机译:SqlSol:准确的SQL查询合成器

获取原文

摘要

SQL is the programming language for communicating with relational databases, but writing SQL queries is challenging for many end users due to lack of programming knowledge. In this paper, we present an efficient and accurate algorithm that helps users to synthesize SQL queries from IO examples, which is the first algorithm to encode SQL synthesis problem into constraint-solving problem. We propose an axiom that encodes the semantics of a SQL query into logic constraints, and decompose the SQL synthesis problem into two parts: problem-encoding and constraint-solving. For the problem-encoding part, we use a SQL template that is same as prior work and parameterize it, then based on this axiom, we encode the parameters into logic constraints. For the constraint-solving part, we use the off-the-shelf modern SMT solvers. Our algorithm supports multiple IO examples, therefore users can add more examples to refine the solution until a correct one is found. We implemented a tool, SqlSol, and evaluated it on 171 benchmarks. The results showed that it efficiently solved 68% of the benchmarks in 3 s in average. For those SqlSol cannot solve, SqlSol terminated in 4 s in average.
机译:SQL是用于与关系数据库进行通信的编程语言,但是由于缺乏编程知识,对于许多最终用户而言,编写SQL查询都具有挑战性。在本文中,我们提出了一种有效且准确的算法,可帮助用户从IO示例中综合SQL查询,这是将SQL综合问题编码为约束解决问题的第一种算法。我们提出了一个将SQL查询的语义编码为逻辑约束的公理,并将SQL综合问题分解为两部分:问题编码和约束解决。对于问题编码部分,我们使用与以前的工作相同的SQL模板并对其进行参数化,然后根据该公理将参数编码为逻辑约束。对于约束求解部分,我们使用现成的现代SMT求解器。我们的算法支持多个IO示例,因此用户可以添加更多示例来完善解决方案,直到找到正确的示例为止。我们实现了一个工具SqlSol,并在171个基准上对其进行了评估。结果表明,它平均可以在3秒钟内解决68%的基准测试问题。对于那些SqlSol无法解决的问题,SqlSol平均在4 s内终止。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号