Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries
Yihao Hu, Amir Gilad, Kristin Stephens-Martinez, Sudeepa Roy, Jun Yang
摘要
We describe a system called Qr-Hint that, given a (correct) target query 𝑄 ★ and a (wrong) working query 𝑄, both expressed in SQL, provides actionable hints for the user to fix the working query so that it becomes semantically equivalent to the target. It is particularly useful in an educational setting, where novices can receive help from Qr-Hint without requiring extensive personal tutoring. Since there are many different ways to write a correct query, we do not want to base our hints completely on how 𝑄 ★ is written; instead, starting with the user's own working query, Qr-Hint purposefully guides the user through a sequence of steps that provably lead to a correct query, which will be equivalent to 𝑄 ★ but may still "look" quite different from it. Ideally, we would like Qr-Hint's hints to lead to the "smallest" possible corrections to 𝑄. However, optimality is not always achievable in this case due to some foundational hurdles such as the undecidability of SQL query equivalence and the complexity of logic minimization. Nonetheless, by carefully decomposing and formulating the problems and developing principled solutions, we are able to provide provably correct and locally optimal hints through Qr-Hint. We show the effectiveness of Qr-Hint through quality and performance experiments as well as a user study in an educational setting.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 3 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- TFix: Learning to Fix Coding Errors with a Text-to-Text Transformer 引用了 CoCoNuT: combining context-aware neural translation models using ensemble for program repair
- Towards Selecting Informative Alternative Relational Query Plans for Database Education 引用了 QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries Faster
- The Power of Constraints in Natural Language to SQL Translation 引用了 Understanding Queries by Conditional Instances
- The Power of Constraints in Natural Language to SQL Translation 引用了 QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries Faster
- I-Rex: An Interactive Debugger for SQL 引用了 Understanding Queries by Conditional Instances
- I-Rex: An Interactive Debugger for SQL 引用了 Language Models are Few-Shot Learners
- I-Rex: An Interactive Debugger for SQL 引用了 QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries Faster
引用它的顶会 Paper3
- The Power of Constraints in Natural Language to SQL TranslationTonghui Ren, Chen Ke, Yuankai Fan, Yinan Jing 等VLDB 2025 · 4 次引用
- Towards Selecting Informative Alternative Relational Query Plans for Database EducationHui Li, Hu Wang, Sourav S. Bhowmick, Zihao MaSIGMOD 2026
- I-Rex: An Interactive Debugger for SQLYihao Hu, Zian Chen, Zhiming Leong, Sharan Sokhi 等VLDB 2026
它引用的 Paper5
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- CoCoNuT: combining context-aware neural translation models using ensemble for program repairThibaud Lutellier, Hung Viet Pham, Lawrence Pang, Yitong Li 等ISSTA 2020 · 325 次引用
- TFix: Learning to Fix Coding Errors with a Text-to-Text TransformerBerkay Berabi, Jingxuan He, Veselin Raychev, Martin T. VechevICML 2021 · 143 次引用
- QueryVis: Logic-based Diagrams help Users Understand Complicated SQL Queries FasterAristotelis Leventidis, Jiahui Zhang, Cody Dunne, Wolfgang Gatterbauer 等SIGMOD 2020 · 36 次引用
- Understanding Queries by Conditional InstancesAmir Gilad, Zhengjie Miao, Sudeepa Roy, Jun YangSIGMOD 2022 · 9 次引用
相关 Paper
- Polygon: Symbolic Reasoning for SQL using Conflict-Driven Under-Approximation SearchPinhan Zhao, Yuepeng Wang, Xinyu WangPLDI 2025
- Memo-SQL: Structured Decomposition and Experience-Driven Self-Correction for Training-Free NL2SQLZerui Yang, Weichuan Wang, Yanwei Xu, Linqi Song 等ACL Findings 2026
- Dial: A Knowledge-Grounded Dialect-Specific NL2SQL SystemXiang Zhang, Le Zhou, Hongming Xu, Wei Zhou 等VLDB 2026 · 2 次引用
- Pi-SQL: Enhancing Text-to-SQL with Fine-Grained Guidance from Pivot Programming LanguagesYongdong Chi, Hanqing Wang, Yun Chen, Yan Yang 等EMNLP Findings 2025
- Automated Validating and Fixing of Text-to-SQL Translation with Execution ConsistencyYicun Yang, Zhaoguo Wang, Yu Xia, Zhuoran Wei 等SIGMOD 2025 · 7 次引用
