AI QueryBot: A RAG-Enhanced Natural Language Interface for Secure and Privacy-Preserving Database Querying
Abstract
This paper presents AI QueryBot, an intelligent conversational interface that leverages Retrieval-Augmented Generation (RAG) and Large Language Models (LLMs) to convert natural language queries into accurate SQL and NoSQL database queries. The system addresses the critical challenge of enabling non-technical users to access and analyse structured data without requiring SQL expertise. By integrating RAG-based schema retrieval with advanced LLM query generation, the system achieves schema-aware query formulation while implementing robust safety mechanisms that prevent destructive database operations. The proposed architecture demonstrates a novel approach to natural language database interfaces, combining the contextual understanding of LLMs with external knowledge retrieval to minimise hallucinations and improve query accuracy. The system operates in four distinct phases: SQL generation, data extraction and analysis with visualisation, SQL explanation for educational purposes, and automated SQL error correction. Experimental evaluation indicates significant improvements in query generation accuracy and a zero-incident rate for potentially harmful database operations. This research contributes to the growing field of AI-powered database interfaces and presents a scalable solution for enterprise data accessibility.
Copyright (c) 2026 Sumaiya Talukdar, Maariya Qureshi, Saqueba Z.M Mistry

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

