{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,10,2]],"date-time":"2026-10-02T08:08:50Z","timestamp":1790928530495,"version":"4.1.0"},"reference-count":43,"publisher":"Association for Computing Machinery (ACM)","issue":"11","content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. VLDB Endow."],"published-print":{"date-parts":[[2021,7]]},"abstract":"<jats:p>SQL is one of the most popular tools for data analysis, and it is now used by an increasing number of users without having expertise in databases. Several studies have proposed programming-by-example approaches to help such non-experts to write correct SQL queries. 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 example tables increases. In this paper, we propose an efficient algorithm utilizing properties known in relational algebra to synthesize SQL queries from input and output tables. Our key insight is that a projection operator in a program sketch can be lifted above other operators by applying transformation rules in relational algebra, while preserving the semantics of the program. This enables a quick inference of appropriate columns in the projection operator, which is an essential component in synthesis but causes combinatorial explosions in prior work. We also introduce a novel form of constraints and its top-down propagation mechanism for efficient sketch completion. We implemented this algorithm in our tool PATSQL and evaluated it on 226 queries from prior benchmarks and Kaggle's tutorials. As a result, PATSQL solved 68% of the benchmarks and found 89% of the solutions within a second. Our tool is available at https:\/\/naist-se.github.io\/patsql\/.<\/jats:p>","DOI":"10.14778\/3476249.3476253","type":"journal-article","created":{"date-parts":[[2021,10,27]],"date-time":"2021-10-27T16:46:23Z","timestamp":1635353183000},"page":"1937-1949","source":"Crossref","is-referenced-by-count":17,"title":["PATSQL"],"prefix":"10.14778","volume":"14","author":[{"given":"Keita","family":"Takenouchi","sequence":"first","affiliation":[{"name":"NTT DATA, Tokyo, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Takashi","family":"Ishio","sequence":"additional","affiliation":[{"name":"Nara Institute of Science and Technology, Nara, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Joji","family":"Okada","sequence":"additional","affiliation":[{"name":"NTT DATA, Tokyo, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"given":"Yuji","family":"Sakata","sequence":"additional","affiliation":[{"name":"NTT DATA, Tokyo, Japan"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2021,10,27]]},"reference":[{"key":"e_1_2_1_1_1","doi-asserted-by":"publisher","DOI":"10.1007\/s00778-019-00567-8"},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1145\/3212695"},{"key":"e_1_2_1_3_1","doi-asserted-by":"publisher","DOI":"10.1145\/3318464.3389776"},{"key":"e_1_2_1_4_1","volume-title":"Proceedings of the International Conference on Learning Representations.","author":"Balog Matej","year":"2017","unstructured":"Matej Balog , Alexander Gaunt , Marc Brockschmidt , Sebastian Nowozin , and Daniel Tarlow . 2017 . DeepCoder: Learning to Write Programs . In Proceedings of the International Conference on Learning Representations. Matej Balog, Alexander Gaunt, Marc Brockschmidt, Sebastian Nowozin, and Daniel Tarlow. 2017. DeepCoder: Learning to Write Programs. In Proceedings of the International Conference on Learning Representations."},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1145\/3360594"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/P19-1448"},{"key":"e_1_2_1_7_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-3-030-32409-4_7"},{"key":"e_1_2_1_8_1","volume-title":"Inferring SQL Queries Using Program Synthesis. CoRR abs\/1208.2013","author":"Cheung Alvin","year":"2012","unstructured":"Alvin Cheung , Armando Solar-Lezama , and Samuel Madden . 2012. Inferring SQL Queries Using Program Synthesis. CoRR abs\/1208.2013 ( 2012 ). Alvin Cheung, Armando Solar-Lezama, and Samuel Madden. 2012. Inferring SQL Queries Using Program Synthesis. CoRR abs\/1208.2013 (2012)."},{"key":"e_1_2_1_9_1","volume-title":"Translating SQL into the relational algebra. Course notes, Hasselt University and Universit\u00e9 Libre de Bruxelles","author":"den Bussche Jan Van","year":"2009","unstructured":"Jan Van den Bussche and Stijn Vansummeren . 2009. Translating SQL into the relational algebra. Course notes, Hasselt University and Universit\u00e9 Libre de Bruxelles ( 2009 ). Jan Van den Bussche and Stijn Vansummeren. 2009. Translating SQL into the relational algebra. Course notes, Hasselt University and Universit\u00e9 Libre de Bruxelles (2009)."},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.5555\/3305381.3305484"},{"key":"e_1_2_1_11_1","doi-asserted-by":"publisher","DOI":"10.14778\/3342263.3342266"},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1145\/3140587.3062351"},{"key":"e_1_2_1_13_1","doi-asserted-by":"publisher","DOI":"10.5555\/1450931"},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1145\/1926385.1926423"},{"key":"e_1_2_1_15_1","volume-title":"Programming by Examples: PL meets ML. Dependable Software Systems Engineering","author":"Gulwani Sumit","year":"2019","unstructured":"Sumit Gulwani and Prateek Jain . 2019. Programming by Examples: PL meets ML. Dependable Software Systems Engineering ( 2019 ). Sumit Gulwani and Prateek Jain. 2019. Programming by Examples: PL meets ML. Dependable Software Systems Engineering (2019)."},{"key":"e_1_2_1_16_1","doi-asserted-by":"publisher","DOI":"10.1561\/2500000010"},{"key":"e_1_2_1_17_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/P19-1444"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.1145\/3368089.3409732"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/N18-2115"},{"key":"e_1_2_1_20_1","doi-asserted-by":"publisher","DOI":"10.1145\/3183713.3183727"},{"key":"e_1_2_1_21_1","volume-title":"Recent Advances in Neural Program Synthesis. CoRR abs\/1802.02353","author":"Kant Neel","year":"2018","unstructured":"Neel Kant . 2018. Recent Advances in Neural Program Synthesis. CoRR abs\/1802.02353 ( 2018 ). Neel Kant. 2018. Recent Advances in Neural Program Synthesis. CoRR abs\/1802.02353 (2018)."},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.1145\/3180155.3182515"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3180155.3180200"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.1145\/2666356.2594333"},{"key":"e_1_2_1_25_1","doi-asserted-by":"publisher","DOI":"10.1145\/3296979.3192410"},{"key":"e_1_2_1_26_1","doi-asserted-by":"publisher","DOI":"10.1016\/j.is.2019.03.002"},{"key":"e_1_2_1_27_1","doi-asserted-by":"publisher","DOI":"10.14778\/3352063.3352098"},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.5555\/3042817.3042840"},{"key":"e_1_2_1_29_1","volume-title":"The Americas Conference on Information Systems. 2212--2222","author":"Nah Fiona","year":"2003","unstructured":"Fiona Nah . 2003 . A Study on Tolerable Waiting Time: How Long Are Web Users Willing to Wait? . In The Americas Conference on Information Systems. 2212--2222 . Fiona Nah. 2003. A Study on Tolerable Waiting Time: How Long Are Web Users Willing to Wait?. In The Americas Conference on Information Systems. 2212--2222."},{"key":"e_1_2_1_30_1","volume-title":"Proceedings of the 36th International Conference on Machine Learning. 4861--4870","author":"Nye Maxwell I.","year":"2019","unstructured":"Maxwell I. Nye , Luke B. Hewitt , Joshua B. Tenenbaum , and Armando Solar-Lezama . 2019 . Learning to Infer Program Sketches . In Proceedings of the 36th International Conference on Machine Learning. 4861--4870 . Maxwell I. Nye, Luke B. Hewitt, Joshua B. Tenenbaum, and Armando Solar-Lezama. 2019. Learning to Infer Program Sketches. In Proceedings of the 36th International Conference on Machine Learning. 4861--4870."},{"key":"e_1_2_1_31_1","doi-asserted-by":"publisher","DOI":"10.14778\/3415478.3415492"},{"key":"e_1_2_1_32_1","volume-title":"TF-Coder: Program Synthesis for Tensor Manipulations. CoRR abs\/2003.09040","author":"Shi Kensen","year":"2020","unstructured":"Kensen Shi , David W. Bieber , and Rishabh Singh . 2020. TF-Coder: Program Synthesis for Tensor Manipulations. CoRR abs\/2003.09040 ( 2020 ). Kensen Shi, David W. Bieber, and Rishabh Singh. 2020. TF-Coder: Program Synthesis for Tensor Manipulations. CoRR abs\/2003.09040 (2020)."},{"key":"e_1_2_1_33_1","doi-asserted-by":"publisher","DOI":"10.1371\/journal.pone.0226112"},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.1145\/2980983.2908102"},{"key":"e_1_2_1_35_1","volume-title":"Program Synthesis with Equivalence Reduction. In International Conference on Verification, Model Checking, and Abstract Interpretation. 24--47","author":"Smith Calvin","year":"2019","unstructured":"Calvin Smith and Aws Albarghouthi . 2019 . Program Synthesis with Equivalence Reduction. In International Conference on Verification, Model Checking, and Abstract Interpretation. 24--47 . Calvin Smith and Aws Albarghouthi. 2019. Program Synthesis with Equivalence Reduction. In International Conference on Verification, Model Checking, and Abstract Interpretation. 24--47."},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.14778\/3137628.3137648"},{"key":"e_1_2_1_37_1","doi-asserted-by":"publisher","DOI":"10.1145\/3140587.3062365"},{"key":"e_1_2_1_38_1","doi-asserted-by":"publisher","DOI":"10.1145\/3371117"},{"key":"e_1_2_1_39_1","doi-asserted-by":"publisher","DOI":"10.14778\/3384345.3384350"},{"key":"e_1_2_1_40_1","doi-asserted-by":"publisher","DOI":"10.1145\/3187009.3177735"},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/D18-1193"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/D18-1425"},{"key":"e_1_2_1_43_1","doi-asserted-by":"publisher","DOI":"10.1109\/ASE.2013.6693082"}],"container-title":["Proceedings of the VLDB Endowment"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.14778\/3476249.3476253","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2022,12,28]],"date-time":"2022-12-28T10:12:11Z","timestamp":1672222331000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.14778\/3476249.3476253"}},"subtitle":["efficient synthesis of SQL queries from example tables with quick inference of projected columns"],"short-title":[],"issued":{"date-parts":[[2021,7]]},"references-count":43,"journal-issue":{"issue":"11","published-print":{"date-parts":[[2021,7]]}},"alternative-id":["10.14778\/3476249.3476253"],"URL":"https:\/\/doi.org\/10.14778\/3476249.3476253","relation":{},"ISSN":["2150-8097"],"issn-type":[{"value":"2150-8097","type":"print"}],"subject":[],"published":{"date-parts":[[2021,7]]}}}