Skip to main content
construction release_alert
The Scholars Team is working with OIT to resolve some issues with the Scholars search index
cancel

Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries

Publication ,  Journal Article
Hu, Y; Gilad, A; Stephens-Martinez, K; Roy, S; Yang, J
Published in: Proceedings of the ACM on Management of Data
May 29, 2024

We describe a system called Qr-Hint that, given a (correct) target query Q* and a (wrong) working query Q, 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 Q* 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 Q* but may still "look" quite different from it. Ideally, we would like Qr-Hint's hints to lead to the "smallest" possible corrections to Q. 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.

Duke Scholars

Altmetric Attention Stats
Dimensions Citation Stats

Published In

Proceedings of the ACM on Management of Data

DOI

EISSN

2836-6573

Publication Date

May 29, 2024

Volume

2

Issue

3

Start / End Page

1 / 27

Publisher

Association for Computing Machinery (ACM)
 

Citation

APA
Chicago
ICMJE
MLA
NLM
Hu, Y., Gilad, A., Stephens-Martinez, K., Roy, S., & Yang, J. (2024). Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries. Proceedings of the ACM on Management of Data, 2(3), 1–27. https://doi.org/10.1145/3654995
Hu, Yihao, Amir Gilad, Kristin Stephens-Martinez, Sudeepa Roy, and Jun Yang. “Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries.” Proceedings of the ACM on Management of Data 2, no. 3 (May 29, 2024): 1–27. https://doi.org/10.1145/3654995.
Hu Y, Gilad A, Stephens-Martinez K, Roy S, Yang J. Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries. Proceedings of the ACM on Management of Data. 2024 May 29;2(3):1–27.
Hu, Yihao, et al. “Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries.” Proceedings of the ACM on Management of Data, vol. 2, no. 3, Association for Computing Machinery (ACM), May 2024, pp. 1–27. Crossref, doi:10.1145/3654995.
Hu Y, Gilad A, Stephens-Martinez K, Roy S, Yang J. Qr-Hint: Actionable Hints Towards Correcting Wrong SQL Queries. Proceedings of the ACM on Management of Data. Association for Computing Machinery (ACM); 2024 May 29;2(3):1–27.

Published In

Proceedings of the ACM on Management of Data

DOI

EISSN

2836-6573

Publication Date

May 29, 2024

Volume

2

Issue

3

Start / End Page

1 / 27

Publisher

Association for Computing Machinery (ACM)