Perfect — here’s a complete, realistic README.md for your TechCorp Database NLP Project, written like a professional open-source or portfolio project explanation.
It gives a clear scenario, database schema overview, project explanation, and a detailed step-by-step setup guide that actually works when followed.
TechCorp is a fictional mid-sized IT company that manages multiple departments, employees, projects, and attendance data. This project demonstrates how users can query a company database using natural language (NLP) — for example:
“Show all employees in the Engineering department” “List all projects managed by the Finance department” “Who has the highest salary at TechCorp?”
The system automatically converts these plain-English questions into SQL queries, executes them on the TechCorp database, and displays structured results.
It combines:
- 🧠 Natural Language Understanding (NLP)
- 💾 SQLite database
- ⚙️ FastAPI backend
- 💻 React frontend
- 🤖 AI model (SQLCoder or LLM API)
TechCorp manages employee and departmental data as part of its internal HR and project tracking system. Here’s how the database reflects real operations:
| Table | Description |
|---|---|
| departments | List of all company departments (HR, Engineering, Finance, etc.) |
| employees | Employee details like name, salary, department, and join date |
| projects | Projects managed by various departments |
| attendance | Daily attendance logs for employees |
- HR queries: “List all employees who joined after 2023.”
- Project manager queries: “Show all projects handled by the Engineering department.”
- Finance queries: “Find the average salary per department.”
- Admin queries: “How many employees were present on 2025-11-08?”
-- departments table
CREATE TABLE departments (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL
);
-- employees table
CREATE TABLE employees (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age INTEGER,
department_id INTEGER,
salary REAL,
date_joined TEXT,
FOREIGN KEY (department_id) REFERENCES departments(id)
);
-- projects table
CREATE TABLE projects (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
department_id INTEGER,
start_date TEXT,
end_date TEXT,
FOREIGN KEY (department_id) REFERENCES departments(id)
);
-- attendance table
CREATE TABLE attendance (
id INTEGER PRIMARY KEY AUTOINCREMENT,
employee_id INTEGER,
date TEXT,
status TEXT,
FOREIGN KEY (employee_id) REFERENCES employees(id)
);| Table | Example Entries |
|---|---|
| departments | Engineering, HR, Finance, Marketing |
| employees | Alice (Engineering, ₹70k), Bob (Finance, ₹60k), Carol (HR, ₹55k) |
| projects | AI Chatbot, Payroll System, Recruitment Tracker |
| attendance | Alice – Present on 2025-11-08 |
git clone https://github.com/yourusername/techcorp-text-to-sql.git
cd techcorp-text-to-sqlpython -m venv venv
.\venv\Scripts\Activate.ps1
# On Windows
# or
source venv/bin/activate # On Linux/Maccd backend
pip install -r requirements.txt📦 Typical dependencies:
fastapi
uvicorn
sqlite3
sqlalchemy
python-dotenv
Run both scripts to generate and populate the SQLite database:
python createdb.py
python init_db.pyThis will create a file named techcorp.db (or init.db) inside the backend folder.
✅ After running, you can verify:
sqlite3 techcorp.db
.tables
SELECT * FROM employees LIMIT 5;uvicorn main:app --reloadBackend runs on http://127.0.0.1:8000
cd ../frontend
npm install
npm run devFrontend runs at http://localhost:5173
- Type a natural language question in the input box (e.g., “Show all employees in HR.”)
- The backend converts it to SQL using the model.
- The result table is displayed instantly.
| Category | Example Query |
|---|---|
| Employees | “Show all employees in the Engineering department.” |
| Projects | “List all projects handled by the Finance department.” |
| Salary | “Who earns the highest salary?” |
| Attendance | “How many employees were present on 2025-11-08?” |
| HR | “Find employees who joined after 2023.” |
| Component | Technology |
|---|---|
| Backend | FastAPI, SQLite |
| Frontend | React, Tailwind |
| NLP Model | SQLCoder or custom LLM |
| ORM | SQLAlchemy |
| API Server | Uvicorn |
- Add employee performance data.
- Integrate authentication and roles.
- Use OpenAI GPT-based SQL translation.
- Add chart visualization (PowerBI-style summary).
Aravind Kumar Data Engineering Enthusiast | Python Developer | TechCorp Demo Creator