LLM-SQL-Solver: Can LLMs Determine SQL Equivalence?
Fuheng Zhao, Jiayue Chen, Lawrence Lim, Ishtiyaque Ahmad, Divyakant, Agrawal, Amr El Abbadi

TL;DR
This paper investigates whether Large Language Models can determine SQL query equivalence, proposing novel prompting techniques and demonstrating their potential to assist data engineers despite existing challenges.
Contribution
The paper introduces two prompting techniques, Miniature & Mull and Explain & Compare, to evaluate semantic and relaxed SQL equivalence using LLMs.
Findings
LLMs show promise in identifying semantically equivalent SQL queries.
The proposed techniques outperform simple execution accuracy metrics.
Challenges remain in fully reliable SQL equivalence determination.
Abstract
Judging the equivalence between two SQL queries is a fundamental problem with many practical applications in data management and SQL generation (i.e., evaluating the quality of generated SQL queries in text-to-SQL task). While the research community has reasoned about SQL equivalence for decades, it poses considerable difficulties and no complete solutions exist. Recently, Large Language Models (LLMs) have shown strong reasoning capability in conversation, question answering and solving mathematics challenges. In this paper, we study if LLMs can be used to determine the equivalence between SQL queries under two notions of SQL equivalence (semantic equivalence and relaxed equivalence). To assist LLMs in generating high quality responses, we present two prompting techniques: Miniature & Mull and Explain & Compare. The former technique is used to evaluate the semantic equivalence in which…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsTopic Modeling · Natural Language Processing Techniques · Semantic Web and Ontologies
