Abstract
Students increasingly use large language models (LLMs) to translate natural-language requests into SQL, yet these models hallucinate: they return queries, numbers, explanations or assurances unsupported by the schema, data, or request, often in a form that executes without error. This paper proposes a teaching instrument for a first course on relational databases, designed to let students experience, recognize and prevent such failures; its contribution is conceptual and illustrative. This paper proposes a teaching instrument for a first course on relational databases that lets students experience, recognize, and prevent such failures. Its core is a taxonomy of fifteen hallucination categories that is coarse enough to serve as a classroom checklist, identified through an expert-driven process (the text-to-SQL literature and 27 years of teaching experience) and illustrated on a five-table PostgreSQL schema through constructed baseline outputs that the instructor can use to open a classroom discussion of each failure. Each category is paired with a two-layer mitigation: a context pack of standing rules and seven reference files, stored once in a Claude Project, and an agentic execute–observe–correct loop in which the assistant runs rule-prescribed checks against a live database before answering. Each countermeasure is assigned to the instructor, the loop, or the user. Nine categories have a counterpart in prior text-to-SQL taxonomies, two lack a dedicated one, and four concern the answer returned to the user rather than the query, thereby escaping static benchmark-based evaluation. The workflow is free for students. The effectiveness and generalizability of the mitigation have not yet been systematically validated; frequency and classroom effectiveness are left to future work.