0% found this document useful (0 votes)
5 views

J.B. Memorial Manas Academy Pithoragarh: Practical File OF Computer Science

Uploaded by

sharmaji4212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

J.B. Memorial Manas Academy Pithoragarh: Practical File OF Computer Science

Uploaded by

sharmaji4212
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

J.B.

MEMORIAL MANAS
ACADEMY
PITHORAGARH

PRACTICAL FILE
OF
COMPUTER SCIENCE

Topic : employee management system

Submitted by Submitted to
Kastura bhat Mr. Devendra
XII ‘A’ Mahori

1|Page
CONTENTS

S No. Name Page no.


1. Certificate 3
2. Acknowledgement 4
3. Project analysis 6
4. About python 7
5. About MySQL 8
6. Introduction and objectives 9
7. Python connectivity with SQL 10
8. Coding 12
9. Future scope 23
10. Enhancement and feature ideas 24
11. Bibliography 25

2|Page
J.B. Memorial Manas Academy
Pithoragarh
CERTIfICATE

This is to certify that Kastura bhat of class 12 ‘A'


has successfully completed the project work on
Computer Science on topic Employment
Management System for class XII practical
examination of the Central Board of Secondary
Education in the year 2023-24. It is further
certified that this project is the individual work of
the candidate.

DEVENDRA Mahori

3|Page
ACkNOwLEDGMENT
I am immensely grateful to my project guide Mr. Devendra Mahori,
for their invaluable guidance and unwavering support throughout the
duration of this project. Their expertise and mentorship have been
instrumental in shaping the project’s direction and ensuring its
successful completion. I would also like to extend my heartfelt
appreciation to my classmates who collaborated with me on this
project. Their contributions and collective effort have greatly enriched
the outcome.

Additionally, I would like to express my gratitude to the school


administration and faculty for providing us with the necessary
resources and opportunities to undertake this project. Their
encouragement and belief in our abilities have been a constant
source of motivation. Finally, I am indebted to my parents and my
sister for their continuous support and encouragement. Their
unwavering faith in me and their willingness to lend a helping hand
whenever needed have been crucial throughout this journey.

4|Page
PROJECT
ANALYSIS
This project is designed to manage and add employees data.It
includes a basic set of all the function required in the any
organisation which are used to reduce the time and increases
the efficiency. It includes-

• Showing data of all employees


• Searching a employee
• Adding employees data
I have examined the needs of an organisation and after the
analysis, I have written the program.This program uses
PYTHON and MYSQL as platform to carry out the task.

5|Page
About
python
Python is a high-level, interpreted programming language that
emphasizes readability and simplicity. Developed by Guido
van Rossum and first released in 1991, Python has become one
of the most popular and versatile programming languages.
Some key features include:

• Readability: Python's syntax is designed to be clear and


readable, making it accessible for both beginners and experienced
developers.
• Versatility:Python supports multiple programming paradigms,
including procedural, object-oriented, and functional
programming. This versatility makes it suitable for a wide range
of applications.
• Dynamic Typing: Python is dynamically typed, allowing for
flexibility in variable assignments and function parameters.
• Open Source: Python is an open-source language,
fosteringcollaboration and allowing developers to
contribute to its development.
• Interpreted Language: Python is an interpreted language,
which means that code can be executed line by line. This
facilitates quick testing and prototyping.

6|Page
About MySQL
MySQL is a widely-used open-source relational database
management system (RDBMS). Developed by Oracle
Corporation, it's known for its reliability, performance, and
ease of use. Key features include:
• Relational Database: MySQL follows a relational database
model, organizing data into tables with predefined relationships.
• Open Source: As an open-source RDBMS, MySQL is freely
available, fostering widespread adoption and community
collaboration.
• Cross-Platform Compatibility: MySQL is compatible with
various operating systems, ensuring versatility across different
environments.
• SQL Language Support: It supports the Structured Query
Language (SQL), providing a standardized means to interact with
databases.
• Scalability: MySQL caters to both small-scale applications and

large-scale enterprise databases, offering scalability to meet


diverse needs.
In summary, MySQL is a powerful and versatile relational
database management system, widely used for its performance,
reliability, and strong community support.

7|Page
Introduction
The software is used to maintain the records of all
employees, adding new employee data and to search for
a employee.

Objective
The objective of this project is to let students apply the
programming knowledge to the real-world situation and
exposed the students how programming skills helps in
developing a good software.

8|Page
CONNECTING
PYTHON TO SqL
import mysql.connector
# Replace these values with your MySQL server details
host = '127.0.0.1' user = 'root' password = 'Sql@369'
database = 'employee' port = 3306 try:
# Connect to the MySQL database
conn = mysql.connector.connect(
host=host, user=user,
password=password,
database=database, port=port
)
# Check if the connection was successful
if conn.is_connected():
print("Connection to MySQL database established
successfully!") except mysql.connector.Error as err:
print(f"Error: {err}") finally:
# Close the connection if 'conn' in
locals() and conn.is_connected():
conn.close()
print("MySQL connection closed.")

Output:
9|Page
10 | P a g e
SOuRCE CODE
Import mysql.connector

Def establish_connection():

Host = ‘127.0.0.1’

User = ‘root’

Password = ‘Sql@369’

Database = ‘employee’

Try:

Connection = mysql.connector.connect(

Host=host,

User=user,

Password=password,

Database=database

Return connection

Except mysql.connector.Error as err:

Print(f”Error: {err}”)

Return None

11 | P a g e
Def create_employee_table(connection):

Try:

Cursor = connection.cursor()

Cursor.execute(“””

CREATE TABLE IF NOT EXISTS employees (

Id INT AUTO_INCREMENT PRIMARY KEY,

Name VARCHAR(255),

Position VARCHAR(255),

Salary DECIMAL(10, 2)

“””)

Connection.commit()

Print(“Employee table created successfully”)

Except mysql.connector.Error as err:

Print(f”Error: {err}”)

Def add_employee(connection, name, position, salary):

Try:

Cursor = connection.cursor()

Cursor.execute(“””

INSERT INTO employees (name, position, salary)

12 | P a g e
VALUES (%s, %s, %s)

“””, (name, position, salary))

Connection.commit()

Print(“Employee added successfully”)

Except mysql.connector.Error as err:

Print(f”Error: {err}”)

Def view_employees(connection):

Try:

Cursor = connection.cursor()

Cursor.execute(“SELECT * FROM employees”)

Employees = cursor.fetchall()

If not employees:

Print(“No employees found.”)

Else:

For employee in employees:

Print(f”ID: {employee[0]}, Name: {employee[1]}, Position: {employee[2]}, Salary:


{employee[3]}”)

Except mysql.connector.Error as err:

Print(f”Error: {err}”)

13 | P a g e
Def search_employee(connection, employee_id):

Try:

Cursor = connection.cursor()

Cursor.execute(“SELECT * FROM employees WHERE id = %s”, (employee_id,))

Employee = cursor.fetchone()

If not employee:

Print(f”No employee found with ID {employee_id}”)

Else:

Print(f”ID: {employee[0]}, Name: {employee[1]}, Position: {employee[2]}, Salary:


{employee[3]}”)

Except mysql.connector.Error as err:

Print(f”Error: {err}”)

If name == “ main ”:

# Establishing a connection

Connection = establish_connection()

If connection:

# Creating the employee table if not exists

Create_employee_table(connection)

14 | P a g e
While True:

Print(“\nEmployee Management System”)

Print(“1. Add Employee”)

Print(“2. View All Employees”)

Print(“3. Search Employee by ID”)

Print(“4. Exit”)

Choice = input(“Enter your choice: “)

If choice == ‘1’:

Name = input(“Enter employee name: “)

Position = input(“Enter employee position: “)

Salary = float(input(“Enter employee salary: “))

Add_employee(connection, name, position, salary)

Elif choice == ‘2’:

View_employees(connection)

Elif choice == ‘3’:

Employee_id = int(input(“Enter employee ID: “))

Search_employee(connection, employee_id)

15 | P a g e
Elif choice == ‘4’:

Break

Else:

Print(“Invalid choice. Please enter a valid option.”)

# Closing the connection

If connection.is_connected():

Connection.close()

Print(“Connection closed”)

OuTPuT wINDOw

16 | P a g e
17 | P a g e
ADDING Employee Data

18 | P a g e
SEARCHING A EMPLOYEE

19 | P a g e
fuTuRE SCOPE Of PROJECT

 Our project have a large scope in the future as it is easy to use,


understand and modify.
 In the age of evolving technology our software 1 aims to
modernize data.
 Our software is a paperless software which make it easy to sustainand
aids the environment.
 Our software increases the precision and efficiency by eliminatingthe
chance of any human error
 Our software is laidback and can be accessed by management.
 Our software helps the organisation to access and maintain the
employee record easily , efficiently and fastly.

ENHANCEMENTS AND fEATuRE IDEAS


o User Authentication: Implement a user authentication system to
distinguish between administrators and regular users. This can allow
administrators to perform additional actions, such as adding or
removing employee
o User role and permission: Introduce user roles with different levels
of permissions. For example, administrators may have full access,
while employees may not.
o Da ta backup and recovery: Set up regular data backups and
implement a recovery mechanism to ensure data integrity and availabili ty.
o Security: security is most important ensures that data must be secure
and the software must be safe from the attack of the hackers.

BIBLIOGRAPHY

 To develop the project following sources were used:

1. Computer science with Sumita Arora


2. https://www.google.com
3. Code with Harry (YouTube channel)
4. Sololearn

You might also like