Qr-Hint: Formally Verified and AI-Explained SQL Tutoring
Abstract
Providing effective feedback on SQL queries is a notorious challenge in database education, as "logical bugs" — where a query runs but produces incorrect results — are difficult for automated tools to diagnose. In this demonstration, we present Qr-Hint, a system designed to support debugging for both students and educators. Rather than relying on test cases or simple syntactical comparison between incorrect and correct queries, Qr-Hint identifies the smallest syntactic edit to a wrong query to make it semantically equivalent to a correct one. It then synthesizes its findings into actionable, natural-language hints using AI, guiding learners to fix the wrong query without revealing the answer. We showcase Qr-Hint in two distinct roles: as an interactive tutor for students that guides them through the debugging process step by step, and as a helper tool for teaching assistants and instructors to identify issues in student queries quickly. Through live scenarios involving missing joins, aggregation errors, and duplicate handling, we demonstrate how Qr-Hint reduces the manual burden of debugging while improving the pedagogical quality of feedback.