A Command-Line Interface (CLI) based Student Database Management System developed using Python and MySQL.
This project allows users to add, search, update, and delete student records stored in a MySQL database — demonstrating fundamental CRUD operations in a simple, interactive Python environment.
✅ Connects Python with MySQL using mysql-connector-python
✅ Interactive CLI menu for easy navigation
✅ Supports inserting, searching, deleting, and updating student data
✅ Uses parameterized SQL queries (safe from SQL injection)
✅ Persistent storage — data saved directly to MySQL database
✅ Simple, beginner-friendly codebase
| Function | Description | SQL Command |
|---|---|---|
| Insert Record | Add a new student to the database | INSERT INTO |
| Search Record | Retrieve student details by Roll Number | SELECT * FROM |
| Delete Record | Remove a student record | DELETE FROM |
| Alter Record | Update existing student details | UPDATE |
Database: STUDENT_DB1
Table: STUD_DATA
CREATE TABLE IF NOT EXISTS STUD_DATA (
ROLL_NUMBER INT PRIMARY KEY,
NAME CHAR(30),
DATE_OF_BIRTH DATE,
ATTENDANCE VARCHAR(30)
);- Language: Python 3.x
- Database: MySQL
- Connector Library: mysql-connector-python
1️⃣ Clone the Repository
git clone https://github.com/your-username/student-dbms-cli.git
cd student-dbms-cli2️⃣ Install Dependencies
pip install mysql-connector-python3️⃣ Setup MySQL Database Login to MySQL and create the database:
CREATE DATABASE STUDENT_DB1;
USE STUDENT_DB1;Optionally, create the table manually:
CREATE TABLE IF NOT EXISTS STUD_DATA (
ROLL_NUMBER INT PRIMARY KEY,
NAME CHAR(30),
DATE_OF_BIRTH DATE,
ATTENDANCE VARCHAR(30)
);4️⃣ Update Connection Settings In the Python file (stud_dbms.py), update your MySQL credentials:
cn = msql.connect(host='localhost', user='root', password='yourpassword')5️⃣ Run the Application
python stud_dbms.pyConnection established to MySQL
--------------------------------------------------------------------------------------
What do you want to do?
1. Insert student record
2. Search student record
3. Delete student record
4. Alter student record
Enter the choice: 1
Enter the Roll number: 101
Enter the student name: Riya Sharma
Enter the date of birth (YYYY-MM-DD): 2005-06-10
Enter attendance (Absent/Present): Present
Record inserted successfully
Do you want to continue further? y/n: yINSERT INTO STUD_DATA (ROLL_NUMBER, NAME, DATE_OF_BIRTH, ATTENDANCE)
VALUES
(1, 'Aarav Sharma', '2004-02-15', 'Present'),
(2, 'Neha Patel', '2005-07-22', 'Absent'),
(3, 'Rohan Mehta', '2004-11-03', 'Present'),
(4, 'Priya Singh', '2005-01-18', 'Present'),
(5, 'Vikram Das', '2003-09-29', 'Absent');student-dbms-cli/
│
├── stud_dbms.py # Main Python program
├── README.md # Project documentation
└── requirements.txt # Python dependencies (optional)- Add GUI using Tkinter or PyQt
- Export student data to CSV or Excel
- Implement student attendance analytics
- Add authentication (admin login)
- Migrate to Flask-based web interface
- Pranav M S Krishnan
- Visit GitHub Profile
This project is open-source and available under the MIT License.
If you found this project useful, give it a star ⭐ on GitHub!