Systempreneur • AI | Cloud | EdTech

Systempreneur • AI | Cloud | EdTech

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?

Systempreneur •AI + Cloud + Ed's avatar
Systempreneur •AI + Cloud + Ed
Jun 21, 2025
∙ Paid

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)

  1. User uploads or selects a .db file (SQLite format)

  2. Streamlit reads schema, lets you preview it

  3. LlamaIndex uses GPT 3.5 Turbo to generate SQL

  4. The app runs the SQL on your DB and shows results

🧠 Code (GitHub)

You can deploy or modify this yourself:

User's avatar

Continue reading this post for free, courtesy of Systempreneur •AI + Cloud + Ed.

Or purchase a paid subscription.
© 2026 Akriti Lal · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture