Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🤖 AI SQL Copilot

Transform Natural Language into Production-Ready SQL Queries using AI

AI SQL Copilot is an intelligent SQL generation platform that converts plain English instructions into valid SQL queries using Google's Gemini AI. It combines AI-powered query generation, SQL validation, conversation history, and a modern glassmorphism interface to create an intuitive SQL assistant for developers, students, and database learners.


✨ Overview

Writing SQL queries manually can be time-consuming, especially for beginners. AI SQL Copilot bridges the gap between natural language and database operations by allowing users to describe what they need in plain English.

Example:

Input

Create an employee table with employee_id, employee_name and salary.

Output

CREATE TABLE employees (
    employee_id INT PRIMARY KEY,
    employee_name VARCHAR(255),
    salary DECIMAL(10,2)
);

🚀 Key Features

AI-Powered SQL Generation

Generate SQL queries directly from natural language prompts.

SQL Validation

Automatically validates generated SQL before displaying results.

Conversation History

Stores previous conversations and allows users to restore past queries.

Copy & Download

One-click copy and SQL file download functionality.

Modern AI Interface

Premium glassmorphism design with smooth animations and responsive layout.

Query Analytics

Tracks generated query count during usage.

Syntax Highlighting

Improved SQL readability through code highlighting.

Responsive Design

Works seamlessly across desktop and mobile devices.


🛠 Tech Stack

Backend

  • Python
  • Flask

AI Engine

  • Google Gemini API

Frontend

  • HTML5
  • CSS3
  • JavaScript

Libraries

  • SQLParse
  • python-dotenv

📂 Project Structure

AI_SQL_CHATBOT/

├── app.py
├── requirements.txt
├── .env

├── chatbot/
│   ├── sql_generator.py
│   └── validator.py

├── templates/
│   └── index.html

├── static/
│   ├── css/
│   │   └── style.css
│   │
│   ├── js/
│   │   └── script.js
│   │
│   └── images/

└── screenshots/

⚙️ Installation

Clone Repository

git clone https://github.com/YOUR_USERNAME/AI-SQL-Copilot.git

Navigate

cd AI-SQL-Copilot

Install Dependencies

pip install -r requirements.txt

Configure Environment Variables

Create a .env file:

GEMINI_API_KEY=YOUR_API_KEY

Run Application

python app.py

Open:

http://127.0.0.1:5000

🎯 Example Prompts

  • Create employee table with id, name and salary
  • Show employees earning above 50000
  • Join employees and departments
  • Find top 10 highest salaries
  • Create customer table with email validation
  • Display orders placed in the last 30 days

📸 Screenshots

Home Screen

(Add Screenshot Here)

SQL Generation

(Add Screenshot Here)

Chat History

(Add Screenshot Here)


🔮 Future Enhancements

  • Multi-database support
  • Query optimization suggestions
  • SQL explanation mode
  • Dark/Light theme switcher
  • Database schema awareness
  • Export to PDF

👨‍💻 Author

Sai Srikar Bommisetty

Passionate about Artificial Intelligence, Machine Learning, Full-Stack Development, and building intelligent software solutions.


⭐ Support

If you found this project useful, consider giving it a star.

About

Transform Natural Language into Production-Ready SQL Queries using AI, Flask, and Google Gemini.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages