0% found this document useful (0 votes)
57 views25 pages

Computer Project File

Uploaded by

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

Computer Project File

Uploaded by

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

CH.

CHHABIL DASS PUBLIC


SCHOOL,GHAZIABAD

COMPUTER SCIENCE
PROJECT FILE

Topic-Employee Management System

XII-B
(SESSION 2024-2025)

Submitted To : Amit Singhal Sir


Submitted By : Romit Gupta
Board Roll no. :
Index
 CERTIFICATE

  ACKNOWLEDGMENTS

  INTRDUCTION

  OBJECTIVES OF THE PROJECT

  PROPOSED SYSTEM

  FILES IMPORTED IN PROJECT

  MODULE FUNCTIONS USED IN PROJECT

  USER DEFINED FUNCTIONS USED IN PROJECT

  ABOUT PYTYON PROGRAMMING LANGUAGE

  ABOUT MY SQL DATABASES

  PROGRAME SOURCE CODE

  PROGRAME OUTPUTS

  BIBLIOGRAPHY
Certificate
This is to certify that Romit Gupta , Palak Goel , Jitender
Kumar of class XII-B has prepared the “Computer Project
File” on the topic “Employee Management System”.

This is certified to be the bonafide work of the student in


Computer Laboratory during the academic year 2024-25.

Date

(Mr. Amit Singhal)


(Computer Science Teacher)

Examiner’s Sign Principal’s Sign

School stamp

Acknowledgment
It is customary for me to acknowledge the contribution and
suggestions received from various sources.

I would like to thank Mr. Amit Singhal who gave me the


opportunity to do this project file of Computer Science.

I wish to acknowledge all the help and encouragement I


received that helped me to complete it.
Introduction
The project is designed to keep records of Employee in specific
department and post who are working in these companies. A table named
employee in MYSQL5.0 to store information about employee Name,
Contact, Address, Post, Salary with Employee ID.

Administrator of the project can enter new record, Display all or specific
passenger record; he can modify and delete records in any table.
Objective of the Project
The main objective of this project is to learn the application of the
programming knowledge into a real-world situation/problem and exposed
the ourselves how programming skills helps in developing a good
software.

1. Write programs utilizing modern software tools.

2. Apply object oriented programming principles effectively when


developing small to medium sized projects.

3. Write effective procedural code to solve small to medium sized


problems.

4. To make file handling easy by using programs.


Proposed System
Today one cannot afford to rely on the fallible human beings of be really
wants to stand against today's merciless competition where not to wise
saying "to err is human" no longer valid, it's out-dated to rationalize your
mistake. So, to keep pace with time, to bring about the best result without
malfunctioning and greater efficiency so to replace the unending heaps of
flies with a much sophisticated hard disk of the computer.

One has to use the data management software. Software has been an
ascent in automation various organizations. Many software products
working are now in markets, which have helped in making the
organizations work easier and efficiently. Data management initially had
to maintain a lot of ledgers and a lot of paperwork has to be done but now
software product on this organization has made their work faster and
easier. Now only this software has to be loaded on the computer and work
can be done.

This prevents a lot of time and money. The work becomes fully
automated and any information regarding the organization can be
obtained by clicking the button. Moreover, now it's an age of computers
of and automating such an organization gives the better look.
Files Imported in Project
1. Import MYSQL for Database connectivity

Module Functions used in Project


1.Connect()-For Database and tables creation

2.Is_connected()- To verify successful database connectivity.

3.Cursor()-To execute MySQL queries

4.Fetchall()-To fetch data from all attributes

5.Commit()- To execute (commit) current code or section

6.Close()- To closes the database connection


User Defined Functions used in Project
1) menu(): Displays the menu and handles user choices.

2) create_database(): Creates a new database named COMPANY.

3) show_database(): Displays the list of all databases.

4) create_table(): Creates the employee table in the database.

5) show_tables(): Lists all tables in the COMPANY database.

6) insert_record(): Inserts a new record into the employee table.

7) update_record(): Updates a specific record in the employee table.

8) delete_record(): Deletes a record from the employee table by ID.

9) search_record(): Searches for records by ID, name, or designation.

10) display_record(): Displays all records in the employee table.

About Python Programming Language


Python is a widely used general-purpose, high-level programming language. It was
initially designed by Guido van Rossum in 1991 and developed by Python Software
Foundation. It was mainly developed to emphasize code readability, and its syntax
allows programmers to express concepts in fewer lines of code.

Python is one of the most popular programming languages today, known for its
simplicity and ease of use. Its clean and straightforward syntax makes it beginner-
friendly, while its powerful libraries and frameworks are perfect for advanced
projects.

Python is used in various fields like web development, data science, artificial
intelligence, and automation, making it a versatile tool for professionals and
learners alike.

Python is a high-level programming language with many features, including:

 Easy to use: Python is designed to be easy to read, write, and interpret. It uses
significant white space to make code more readable.

 Object-oriented: Python uses an object-oriented approach to organize software


design around data and objects.

 Portable: Python is highly portable.

 Open source: Python is free and open source software.

 Extensive libraries: Python has a large selection of libraries.

 Supports other languages: Python supports other languages.

 Community support: Python has a supportive community.

 Multipurpose: Python is a general-purpose programming language.

 Machine learning: Python supports machine learning.

 Third-party modules: Python has third-party modules.

 User-friendly data structures: Python has user-friendly data structures.


Python is often used for developing software and websites, data analysis, data
visualization, and task automation. It's also relatively easy to learn, so non-
programmers like scientists and accountants use it for everyday tasks like organizing
finances.

About My Sql Database


SQL stands for Structured Query Language. It is a standardized programming
language used to manage and manipulate relational databases. It enables users to
perform a variety of tasks such as querying data, creating and modifying database
structures, and managing access permissions. SQL is widely used across various
relational database management systems such as MySQL, PostgreSQL, Oracle, and
SQL Server.

Components of a SQL System


A SQL system consists of several key components that work together to enable
efficient data storage, retrieval, and manipulation. Understanding these components
is crucial for mastering SQL and its role in relational database systems. Some of the
Key components of a SQL System are:
 Databases: Databases are structured collections of data organized into tables,
rows, and columns. Databases serve as repositories for storing information
efficiently and provide a way to manage and access data.
 Tables: Tables are the fundamental building blocks of a database, consisting of
rows (records) and columns (attributes or fields). Tables ensure data integrity
and consistency by defining the structure and relationships of the stored
information.
 Queries: Queries are SQL commands used to interact with databases. They
enable users to retrieve, update, insert, or delete data from tables, allowing for
efficient data manipulation and retrieval.
 Constraints: Constraints are rules applied to tables to maintain data
integrity. Constraints define conditions that data must meet to be stored in the
database, ensuring accuracy and consistency.
 Stored Procedures: Stored procedures are pre-compiled SQL statements stored
in the database. Stored procedures can accept parameters, execute complex
operations, and return results, enhancing efficiency, re-usability, and security in
database management.
 Transactions: Transactions are groups of SQL statements that are executed as a
single unit of work. Transactions ensure data consistency and integrity by
allowing for the rollback of changes if any part of the transaction fails.

Characteristics of SQL
 User-Friendly and Accessible: SQL is designed for a broad range of users,
including those with minimal programming experience, making it approachable
for non-technical individuals.
 Declarative Language: As a non-procedural language, SQL allows users to
specify what data is needed rather than how to retrieve it, focusing on the
desired results rather than the retrieval process.
 Efficient Database Management: SQL enables the creation, modification, and
management of databases efficiently, saving time and simplifying complex
database operations.
 Standardized Language: Based on ANSI (American National Standards
Institute) and ISO (International Organization for Standardization) standards,
SQL ensures consistency and stability across various database management
systems (DBMS).
 Command Structure: SQL does not require a continuation character for multi-
line queries, allowing flexibility in writing commands across one or multiple
lines.
 Execution Mechanism: Queries are executed using a termination character
(e.g., a semicolon ;), enabling immediate and accurate command processing.
 Built-in Functionality: SQL includes a rich set of built-in functions for data
manipulation, aggregation, and formatting, empowering users to handle diverse
data-processing needs effectively.

SQL Commands
Structured Query Language (SQL) commands are standardized instructions used by
developers to interact with data stored in relational databases. These commands
allow for the creation, manipulation, retrieval, and control of data, as well as
database structures. SQL commands are categorized based on their specific
functionalities:
1. Data Definition Language
SQL commands used to create the database structure are known as data definition
language (DDL). Based on the needs of the business, database engineers create and
modify database objects using DDL. DDL commands are : Create , Drop and Alter
2. Data Manipulation Language
A relational database can be updated with new data using data manipulation
language (DML) statements. DML commands are : insert into, update and delete .
3. Transaction Control Language
TCL commands manage transactions in relational databases, ensuring data integrity
and consistency. These commands are used to commit changes or roll back
operations in case of errors. TCL commands are : commit , rollback and save point .
SOURCE CODE

import mysql.connector as mob

def create_database():
con=mob.connect(host='localhost',user='root', passwd='1234')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
cur.execute('CREATE DATABASE COMPANY')
print()
print("Database Created")
con.close()
else:
print("Error : Database Connection is not success" )

def show_database():
con=mob.connect(host='localhost',user='root', passwd='1234')
if con.is_connected():
print("Successfully Connected")
cur = con.cursor()
cur.execute('SHOW DATABASES')
for i in cur:
print(i)
con.close()
else:
print("Error : Database Connection is not success" )

def create_table():
con=driver.connect(host='localhost',user='root',password='1234',
database='COMPANY')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
cur.execute('create table employee(id int primary key, ename
varchar(15), salary float, doj date, dob date ,city varchar(10),desig
varchar(29))')
print()
print("Table Created -> EMPLOYEE")
con.commit()
con.close()
else:
print("Error : Database Connection is not success" )

def show_tables():
con=mob.connect(host='localhost',user='root',passwd='1234',
database='COMPANY')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
cur.execute('show tables')
for i in cur:
print(i)
con.commit()
con.close()
else:
print("Error : Database Connection is not success" )

def insert_record():
con = mob.connect(host='localhost', user='root', passwd='1234',
database='COMPANY')
if con.is_connected():
cur = con.cursor()
ID = int(input("ENTER EMPLOYEE ID: "))
NAME = input("ENTER NAME OF EMPLOYEE: ")
SALARY = float(input("ENTER EMPLOYEE SALARY: "))
DOJ = input("ENTER DATE OF JOINING OF EMPLOYEE: ")
DOB = input("ENTER DATE OF BIRTH: ")
CITY = input("ENTER THE NAME OF CITY: ")
DESIG = input("ENTER THE DESIGNATION OF EMPLOYEE: ")

query1 = "INSERT INTO employee(id, ename, salary, doj, dob, city,


desig) VALUES (%s, %s, %s, %s, %s, %s, %s)"
values = (ID, NAME, SALARY, DOJ, DOB, CITY, DESIG)
cur.execute(query1, values)
con.commit()
print('Record Inserted')
con.close()
else:
print("Failed to connect to the database.")

def update_record():
con = mob.connect(host='localhost', user='root', passwd='1234',
database='COMPANY')
if con.is_connected():
print("Successfully Connected")
cur = con.cursor()
d = int(input("Enter Employee ID for update record: "))
ID = int(input("ENTER NEW EMPLOYEE ID: "))
NAME = input("ENTER NEW NAME OF EMPLOYEE: ")
SALARY = float(input("ENTER NEW SALARY FOR
EMPLOYEE: "))
DOJ = input("ENTER DATE OF JOINING OF EMPLOYEE: ")
DOB = input("ENTER DATE OF BIRTH: ")
CITY = input("ENTER THE NAME OF CITY: ")
DESIG = input("ENTER THE DESIGNATION OF EMPLOYEE: ")
query1 = "UPDATE employee SET id = %s, ename = %s, salary =
%s, doj = %s, dob = %s, city = %s, desig = %s WHERE id = %s"
values = (ID, NAME, SALARY, DOJ, DOB, CITY, DESIG, d)
cur.execute(query1, values)
con.commit()
print("Record Updated")
con.close()
else:
print("Error : Database Connection is not success" )

def delete_record():
con=mob.connect(host='localhost',user='root',passwd='1234',
database='COMPANY')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
d=int(input("Enter Employee ID for deleting record : "))
query1="delete from employee where id=%s"
values=(d,)
cur.execute(query1,values)
con.commit()
print("Record Deleted")
con.close()
else:
print("Error : Database Connection is not success" )

def search_record():
con=mob.connect(host='localhost',user='root',passwd='1234',
database='COMPANY')
if con.is_connected():
print("Successfully Connected")
cur=con.cursor()
print("ENTER THE CHOICE ACCORDING TO YOU WANT TO
SEARCH RECORD: ")
print("1. ACCORDING TO ID")
print("2. ACCORDING TO NAME")
print("3. ACCORDING TO DESIGNATION")
print()
choice=int(input("ENTER THE CHOICE (1-3) : "))
if choice==1:
d=int(input("Enter Employee ID which you want to search : "))
query1="select * from employee where id=%s"
v=(d,)
cur.execute(query1,v)
elif choice==2:
d=input("Enter Employee Name which you want to search : ")
query1="select * from employee where ename=%s"
v=(d,)
cur.execute(query1,v)
elif choice==3:
d=input("Enter Employee Designation which you want to search :
")
query1="select * from employee where desig=%s"
v=(d,)
cur.execute(query1,v)
else:
print("Wrong Choice")
rec=cur.fetchall()
count=0
count=len(rec)
print("Total no. of records found : ",count)
for i in rec:
print(i)
print("Record Searched")
con.close()
else:
print("Error : Database Connection is not success")

def display_record():
con=mob.connect(host='localhost',user='root',passwd='1234',
database='COMPANY')
if con.is_connected():
cur=con.cursor()
cur.execute('select * from employee')
rec=cur.fetchall()
count=cur.rowcount
for i in rec:
print(i)
print()
con.close()
else:
print("Error : Database Connection is not success" )

def menu():
while True:
print("........MENU.......")
print("1. CREATE DATABASE")
print("2. SHOW DATABASES")
print("3. CREATE TABLE")
print("4. SHOW TABLES")
print("5. INSERT RECORD")
print("6. UPDATE RECORD")
print("7. DELETE RECORD")
print("8. SEARCH RECORD")
print("9. DISPLAY RECORD")
print("10. EXIT")
print()
print()
choice=int(input("Enter the choice (1-10) : "))
if(choice==1):
create_database()
elif(choice==2):
show_databases()
elif(choice==3):
create_table()
elif(choice==4):
show_tables()
elif(choice==5):
insert_record()
elif(choice==6):
update_record()
elif(choice==7):
delete_record()
elif(choice==8):
search_record()
elif(choice==9):
display_record()
elif(choice==10):
print("Exiting….")
break
else:
print("Invalid choice! Please try again.")

menu()
OUTPUTS
BIBLIOGRAPHY
1. www.google.com

2. Textbook of Computer Science for XII written by


Sumita Arora

You might also like