Skip to content

sarasstha5/CLI-based-python-db-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

Student Database Management System

A Python application for managing student records in a PostgreSQL database with an interactive menu-driven interface.

Features

  • Add Student: Insert new student records with the following details:

    • First Name, Last Name
    • Age, Address
    • Email (Gmail)
    • Gender, Semester
  • View Students: Display all student records from the database

  • Update Students: Modify existing student information (supports updating fname, lname, age, address, gmail, and semester)

Requirements

  • Python 3.x
  • PostgreSQL database
  • psycopg2 - PostgreSQL adapter for Python
  • python-dotenv - Load environment variables from .env file

Installation

  1. Install required packages:

    pip install psycopg2 python-dotenv
  2. Create a .env file in the project root with your database credentials:

    DB_HOST=your_host
    DB_PORT=your_port
    DB_NAME=your_database
    DB_USER=your_username
    DB_PASSWORD=your_password
    

Usage

Run the application:

python main.py

Menu Options

  • Option 1: Add a new student (follow the prompts to enter student details)
  • Option 2: View all students in the database
  • Option 3: Exit the application

Database Schema

The application expects a students table with the following columns:

  • fname (VARCHAR)
  • lname (VARCHAR)
  • age (INTEGER)
  • address (VARCHAR)
  • gmail (VARCHAR)
  • gender (VARCHAR)
  • semester (VARCHAR)

Notes

  • Ensure PostgreSQL server is running before starting the application
  • Database credentials should be stored securely in the .env file (not committed to version control)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages