Skip to content

soumyaR5/sql-tutor-and-query-debugger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  AI Powered SQL Tutor & Query Debugger

An AI-powered platform that helps users debug SQL queries, understand database errors, and learn SQL concepts interactively through intelligent explanations and query correction assistance.


๐Ÿ“Œ Problem Statement

Learning SQL can be challenging for beginners, especially when dealing with syntax errors, incorrect query logic, and understanding database concepts. Many learners struggle to identify why a query fails and how to fix it efficiently.

This project aims to simplify the SQL learning process by providing:

  • Intelligent SQL query debugging
  • Beginner-friendly explanations
  • Query correction suggestions
  • Interactive AI-powered assistance

๐Ÿš€ Features

  • โœ… SQL Query Debugging
  • โœ… SQL Error Detection & Correction
  • โœ… Natural Language Explanation of Queries
  • โœ… Beginner-Friendly SQL Guidance
  • โœ… AI-Powered Query Assistance
  • โœ… Interactive Learning Support
  • โœ… SQL Concept Understanding

๐Ÿง  How It Works

  1. User enters an SQL query
  2. The system analyzes query syntax and logic
  3. AI identifies mistakes and problematic statements
  4. Suggested corrections are generated
  5. The corrected query is explained in simple language

๐Ÿ› ๏ธ Tech Stack

Backend

  • Python

Database

  • SQL

AI & NLP

  • NLP Techniques
  • AI / LLM Integration

Tools & Libraries

  • OpenAI API
  • Environment Variables (.env)

๐Ÿ“‚ Project Structure

ai-sql-debugger/
โ”‚
โ”œโ”€โ”€ main.py              # Main application entry point
โ”œโ”€โ”€ utils.py             # Utility/helper functions
โ”œโ”€โ”€ requirements.txt     # Project dependencies
โ”œโ”€โ”€ .env.example         # Sample environment variables
โ”œโ”€โ”€ .gitignore           # Ignored files
โ””โ”€โ”€ README.md

๐Ÿ” Environment Variables

Create a .env file in the root directory and add:

OPENAI_API_KEY=your_api_key_here

โš ๏ธ Note:

  • Never expose your API key publicly
  • .env is ignored using .gitignore

โš™๏ธ Installation & Setup

1๏ธโƒฃ Clone the Repository

git clone https://github.com/soumyaR5/sql-tutor-and-query-debugger.git
cd sql-tutor-and-query-debugger

2๏ธโƒฃ Install Dependencies

pip install -r requirements.txt

3๏ธโƒฃ Configure Environment Variables

Create a .env file and add your OpenAI API key.

Example:

OPENAI_API_KEY=your_api_key_here

4๏ธโƒฃ Run the Application

chainlit run app.py

๐Ÿ“ธ Screenshots

Home Interface

image

SQL Query Debugging

image

Error Explanation and Corrected Query Output

image

Practice Questions

image

๐Ÿ“Š Use Cases

  • ๐Ÿ“š SQL Learning for Beginners
  • ๐Ÿง‘โ€๐Ÿ’ป Query Debugging Practice
  • ๐Ÿ“ˆ Data Analyst SQL Preparation
  • ๐ŸŽฏ Interview Preparation
  • ๐Ÿ—„๏ธ Database Query Validation
  • ๐Ÿค– AI-assisted SQL Learning

๐ŸŽฏ Key Learning Outcomes

Through this project:

  • Improved understanding of SQL debugging
  • Explored AI-assisted query analysis
  • Worked with NLP-based explanations
  • Learned API integration concepts
  • Built an educational developer tool

๐Ÿ”ฎ Future Enhancements

  • ๐ŸŒ Web-based UI using Streamlit / React
  • ๐Ÿ—„๏ธ PostgreSQL & MySQL Integration
  • ๐Ÿ“Š Query Performance Optimization Suggestions
  • ๐Ÿ“ˆ Query History Dashboard
  • ๐Ÿ” User Authentication
  • ๐Ÿค– More Advanced AI Query Suggestions
  • ๐Ÿ“š SQL Practice Exercises

๐Ÿค Contribution

Contributions, suggestions, and improvements are welcome.

Feel free to:

  • Fork the repository
  • Create feature branches
  • Submit pull requests

๐Ÿ‘ค Author

Soumya Ramchandran

Aspiring Data Analyst | AI & BI Enthusiast | SQL & Backend Development Learner


๐Ÿ”— GitHub Repository

GitHub: https://github.com/soumyaR5/sql-tutor-and-query-debugger


โญ Support

If you found this project useful:

  • Give this repository a โญ
  • Share feedback
  • Connect on LinkedIn

๐Ÿ“„ License

This project is intended for educational and learning purposes.

About

This project is an AI-powered SQL assistant that helps users debug SQL queries, understand errors, and learn SQL concepts interactively using Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages