AI QueryBot: A RAG-Enhanced Natural Language Interface for Secure and Privacy-Preserving Database Querying

  • Sumaiya Talukdar Student, Sophia College for Women, Mumbai, Maharashtra, India
  • Maariya Qureshi Student, Sophia College for Women, Mumbai, Maharashtra, India
  • Saqueba Z.M Mistry Faculty, Sophia College for Women, Mumbai, Maharashtra, India
Keywords: Retrieval-Augmented Generation, Text-to-SQL, Large Language Models, Natural Language Processing, Database Query Generation

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.

Published
2026-01-23