https://sql-query-generator2.vercel.app/
The Natural Language to SQL Query Generator is a Python-based web application that allows users to query a database using plain English instead of writing SQL queries manually.
The system converts natural language input into SQL queries, executes them on a SQLite database, and displays the results through a web interface.
This project demonstrates the integration of Natural Language Processing concepts, SQL databases, and web application development using Flask.
- Convert English queries into SQL statements.
- Execute SQL queries on a SQLite database
- Display query results in a web interface
- Support filtering, sorting, and analytical queries
- Simple and clean **Flask-based web application
- Beginner-friendly rule-based NLP system
Users can ask questions like:
show all students
show cse students
show students marks greater than 80
show students marks less than 70
show top students
show average marks
show total students
Generated SQL example:
SELECT * FROM students WHERE marks > 80;
- Python
- SQL
- SQLite
- Flask
- HTML / CSS
User Input (Browser)
↓
Flask Web Application
↓
Natural Language Processing Logic
(sql_generator.py)
↓
Generated SQL Query
↓
Database Execution
(SQLite)
↓
Results Displayed in Browser
sql-query-generator
│
├── app.py
├── sql_generator.py
├── execute_query.py
├── database_setup.py
│
├── templates
│ └── index.html
│
├── college.db
└── README.md
git clone https://github.com/your-username/sql-query-generator.git
cd sql-query-generator
pip install flask pandas nltk
python database_setup.py
python app.py
http://127.0.0.1:5000
- Understanding different natural language query formats
- Extracting numeric values from user input
- Handling invalid queries gracefully
- Uses rule-based NLP, so it cannot understand complex sentences
- Currently supports only a single database table
- Limited query patterns
- Integrate AI-based Text-to-SQL models
- Support multiple database tables
- Add voice-based queries
- Improve UI with modern frontend frameworks
- Deploy the application online
Through this project, I learned:
- How to integrate Python with SQL databases
- How to build web applications using Flask
- Basic concepts of Natural Language Processing
- How backend logic interacts with databases
Bharath Kumar
Computer Science Student Interested in AI, Web Development, and Software Engineering