AI-Ready Engineer Day 11: LLM Writes SQL for Your Data using RAG Over SQL
What if non-technical users could ask questions in plain English — and get SQL-powered answers from your database?
Welcome to Day 11 of the AI Engineering Series:
We’re building a working RAG (Retrieval Augmented Generation) pipeline using SQLite + LlamaIndex + OpenAI that converts natural language questions into SQL queries — then runs those queries over your uploaded database.
And yes — you can test it live 👇
🚀 Live App Link
👉 ragforsql-instrovate.streamlit.app
📥 Sample .db Files to Try Out
Upload your own SQLite file, or use one of the sample databases below:
Dataset Description Download
🧑💼 Employee Simple table with name, age, salary, dept Download
📊 Sales Region-wise sales and revenue data Download
🎓 Courses Courses + student enrollments (joins) Download
💬 Sample Questions You Can Ask
Here are some natural language prompts that work great with each database:
🧑💼 Employee DB
“Who is the highest paid employee?”
“List all employees in Engineering.”
“What’s the average salary in Sales?”
📊 Sales DB
“Which region had the highest revenue?”
“List products sold in the West.”
“What is the total quantity sold for Laptops?”
🎓 Courses DB
“Who is enrolled in Python Basics?”
“How many students completed the Data Science course?”
“List all active enrollments with instructor names.”
🧱 How It Works (Architecture)
User uploads or selects a
.dbfile (SQLite format)Streamlit reads schema, lets you preview it
LlamaIndex uses GPT 3.5 Turbo to generate SQL
The app runs the SQL on your DB and shows results
🧠 Code (GitHub)
You can deploy or modify this yourself:




