Employee Management System Project in Python Source Code

The Employee Management System Project in Python with Source Code is a beginner-friendly Python project that will teach them how to create web-based Python projects.

We will supply you with the complete source code and database for the Python project so that you can quickly install it on your machine and begin learning Python programming.

Project Details and Technology

Project Name:Employee Management System Project in Python With Source Code
AbstractAn employee management system is a software, that helps your employees to give their best efforts every day to achieve the goals of your organization.
Language/s Used:Python
Python version (Recommended):3.8/3.9
Database:MySQL
Type:Desktop Application
Developer:Source Code Hero
Updates:0
Employee Management System Project in Python With Source Code – Project Information

Why is an Employee Management System Important?


Employee Management System aids in the automation of manual processes, saving both time and money. This system safeguards the professional and personal information of employees and the firm.

HR and business managers are relieved of their burdens and pressures thanks to the personnel management system.

About Employee Management System Project

An Employee Management System Project in Python is created in Python Programming Language using PyCharm Community IDE.

This Simple Project was developed using a console-based and connected to MySQL Database as the system’s Back-end.

Goal Of The Project

The goal is to construct a Python-based database-driven Employee Management System that stores data in a MySQL database.

The following operations will be included in the script from the project:

  • Add Employee
  • Remove Employee
  • Promote Employee
  • Display Employees

The idea is that we use different functions to perform different changes in our Employee Record, for example, the Add Employee function will insert a new row in our Employee table, and we will also create a Remove Employee Function that will delete the record of any existing employee in our Employee table.

How Do You Create An Employee Management System In Python?

We need to link Python to MySQL in order to create an Employee Management System in Python that uses MySQL as a database.

Create Database

First create database named “emp“.

Create Database Table

Second after creating database, create a table named “empd” and table fields : “id“, “name“, “post“, “salary“.

after that copy all the code given below.

Create Connection Under Python and MySQL

import mysql.connector

# making Connection
con = mysql.connector.connect(
host="localhost", user="root", password="", database="emp")

Check Employee Function

The check employee function accepts an employee ID as an argument and examines whether the employee details record contains any employees with that id.

It uses the cursor.rowcount() function to check this, which counts the number of rows that match the specified details.

It is a utility function that will be used in later operations such as the Add employee function, among others.

Program:

# Function To Check if Employee with
# given Id Exist or Not
def check_employee(employee_id):
    # Query to select all Rows f
    # rom employee Table
    sql = 'select * from empd where id=%s'

    # making cursor buffered to make
    # rowcount method work properly
    c = con.cursor(buffered=True)
    data = (employee_id,)

    # Executing the SQL Query
    c.execute(sql, data)

    # rowcount method to find
    # number of rows with given values
    r = c.rowcount
    if r == 1:
        return True
    else:
        return False

Add Employee Function

The Add Employee function will ask for the Employee ID and then use the Check Employee function to see if the employee to be added already exists in our database or not.

If the employee details do not already exist, the Add Employee function will ask for the employee’s name, job title, and salary.

Now, after receiving all of these facts from the system’s user, it simply enters the data into our Employee details table.

Program:

# Function to mAdd_Employee
def Add_Employ():
    Id = input("Enter Employee Id : ")

    # Checking if Employee with given Id
    # Already Exist or Not
    if (check_employee(Id) == True):
        print("Employee aready exists\nTry Again\n")
        menu()

    else:
        Name = input("Enter Employee Name : ")
        Post = input("Enter Employee Post : ")
        Salary = input("Enter Employee Salary : ")
        data = (Id, Name, Post, Salary)

        # Inserting Employee details in
        # the Employee Table
        sql = 'insert into empd values(%s,%s,%s,%s)'
        c = con.cursor()

        # Executing the SQL Query
        c.execute(sql, data)

        # commit() method to make changes in
        # the table
        con.commit()
        print("Employee Added Successfully ")
        menu()

To start executing the Employment Management System Project in Python, make sure that you have installed Python 3.9 and PyCharm on your computer.

Steps On How To Run The Project

Time needed: 5 minutes

These are the steps on how to run an Employee Management System Project in Python With Source Code

  • Step 1: Download the given source code below.

    First, download the given source code below and unzip the source code.
    movie ticket booking system in php

  • Step 2: Extract zip.

    Next, right-click the zip file and extract the file.

  • Step 3: Import the project to your PyCharm IDE

    Next, import the source code you’ve downloaded to your PyCharm IDE.
    Blackjack Game In Python

  • Step 4: Run the project.

    Last, right-click and click run.
    Space Invaders Game In Python

Download the Source Code below

Summary

This Employee Management System Project in Python with MySQL is an easy console-based machine that’s very clean to apprehend and use.

Talking approximately the gadget, contains all of the basic functions which consist of creating a new employee, removing employee records, promoting employees, and displaying all employee records.

Also, visit the other free downloadable source code used in the employee management system.

Inquiries

If you have any questions or suggestions about the Employee Management System Project in Python With Source Code, please feel free to leave a comment below.

Leave a Comment