Project SQL

Download as pdf or txt
Download as pdf or txt
You are on page 1of 27

CONTENT OF PROJECT

1. College Certificate
2. Acknowledgement
3. Project Outline
4. Objectives of the project
5. Technology used
a. Introduction of Python
6. Introduction of MySQL
6. Database design & database used
7. Coding
8. Output
9. Limitation
10. Bibliography
CERTIFICATE

This is to certify that Mohammad uzair siddiqui, a


student of class XII, Roll no. 14 has successfully
completed the research on below mentioned topic
under the guidance of Mrs reeta during the session
2023-24 in partial fulfillment of computer
examination conducted by CBSE in Wood Row
School.

Teachers signature
ACKNOWLEDGEMENT

It's with pride and deepest sense of gratitude that, I place


my profound expression toward my college "WOODROW
SCHOOL BARELLY" and its illustrious staff especially my
most respected "reeta maam" for her matured & inspiring
guidance.

This project is based on my study and practice during the


session 2023-24 partial fulfilment of computer examination
conducted by CBSE in Wood Row School. Though I have
tried my almost for making this project unique I itself, still
flexible at few points. I would like to express my deep
gratitude to all those who have encouraged and helped me
to prepare my software package.

I am also grateful to my friends for their valuable suggestion


and words of inspiration for my project work i.e. "PAYROLL
MANAGEMENT SYSTEM". My sincere thanks are due to my
parents for their co-operation and encouragement.
PROJECT OUTLINE
The project entitled "PAYROLL Management SYSTEM" is
basically, developed in the "WOOD ROW SCHOOL",
BAREILLY. This projects basically help in the PAYROLL
MANAGEMENT SYSTEM for automatic entry, preparing, and
analysing the various types of Data Entry related to the employees.
Although it is very time-consuming activity as its different persons
like: -
• Record Generators
• Record Stored for long time
●Many persons are involved in this project.
• Maintenance of Record of employees.
●Preparation of record efficiently and effectively
OBECTIVES OF THE PROJECT
The project is developed for the Organization which needs to
prepare the report of the customers and employees, maintain the
The main idea behind the project is to provide the Organization
RECORD and information as well upgrade their system up to data.
"FULLY AUTOMATED COMPUTERISED SYSTEM which is
beneficial for the DEPARTMENT who can access records their
own places through their computers and can not only get name of
employee with a minute but can gather huge amount of
information.
So, for quick preparation or maintenance of the different types of
records, result require a lot of manual personals within the
organization as well as, design and analysis, therefore the chances
of making mistakes and delays in system by the humans which can
produce fatal errors which are high and are liable.
Such project is cost oriented and less time consuming which
helps the education a lot etc.
Hardware are the physical components used which can be seen
and touched by us. Hardware specification of the machine which
is used to develop the project entitled as "TRAVELLING
AGENCY" is as follows:-

HARDWARE'S CATEGORY USED

RAM 4 GB RAM
PROCESSOR Dual core, 1.70 GHz
HARD DISK 320 GB
MONITOR SVGA (COLOR MONITOR)
CD-DRIVE SAMSUNG 52X MAX

KEYBOARD 102 KEYS

MOUSE 2 BUTTON (QUANTUM)


It will work on, hard disk as well as floppy disk along with VB
6.0 but you use hard disk for voluminous data processing it will
increase the access ability.
import mysql.connector
import datetime
db=input("Enter name of your database:")
mydb=mysql.connector.connect(host='localhost',user='root,passwd=
'root)
mycurso=mydb.cursor()
sql="CREATE DATABASE if not exists os" % (db,)
mycursor.execute(sq)
print("Database created successfully...")
mycursorFmydb.cursor()
mycursor.execute("'use "+db)
TableName-input("Name of table to be created:")
query="Create table if not exists "+TableName+"\
(empno int primary key,\
name varchar(15) not null,)\)
job varchar(15),\
BasicSalary int,\
DA float,l HRA float,\
GrossSalary float,\
Tax float,\
NetSalary float)"
print("Table"+TableName+"created successfully....")
mycursor. execute(query)
print("\n')
print("*"*95)
print(\t\t\t\t\tPA YROLL MANAGEMENT SYSTEM ")
print("*"*95)
print(\n')
print("*"*95)
print(\t\t\t\t\tDEVELOPED BY UZAIR SIDDIQUI')
print("*"*95)
print(n')
print("* "*95)
print(\t\tlt\t\tMAIN MENU')
print("* "*95)
print(\t\t\ttl. Adding Employee records')
print(\t\ltltlt2. For Displaying Record of All the Employees')
prínt(\t\tltit3. For Displaying Record of a particular Employee')
print(\ltltlt4. For deleting Record of all the Employees')
print("\t\t\t\t5. For Deleting a Record of a particular employees')
print("\t\t\t\t6. For Modification in a Record')
print("\t\t\t\t7. For exit')

while True:
print("Enter choice....",end=")
choice=int(input())
if choice-1:
print('Enter Employee information.....')
mempno=int(input('Enter employee no:')) mname=input('Enter
employee name:')
mjob input("Enter employee job:')
mbasic-float(input('Enter basic salary:'))
if mjob.upper()-'OFFICER':
mda-mbasic 0.5
mhra-mbasic*0.35
mtax-mbasic 0.2
elif mjob.upper()-' [ ANAGE * R' :
mda mbasic 0.45
mhra-mbasic 0.30
mtax-mbasic 0.15
else:
mda mbasic 0.40
mhra-mbasic 0.25
mtax-mbasic*0.1
mgross-mbasic+mda+mhra
mnet-mgross-mtax
rec (mempno,mname,mjob,mbasic,mda,mhra, mgross,mtax,mnet)
query="insert into "+TableName+" values
(%s, %s, %s, %s, %s, %s, %s, %s, %s)"
mycursor.execute(query,rec)
mydb.commit()
print('Record added successfully....')
elif(choice-2):
query="select from" +TableName
mycursor.execute(query)
myrecord=mycursor.fetchall()
print(myrecord)
elif choice-3:
en-input('Enter employee no. of the record to be displayed...')
query="select from "+TableName+" where empno="+en
mycursor.execute(query)
myrecord mycursor.fetchone()
print("\n\nrecord of Employee no.:"+en)
print(myrecord)
c-mycursor.rowcount
if c = - 1

print('Nothing to display')
elif choice-4:
ch-input('Do you want to delete all the records (y/n))
if ch.upper O=^ prime Y' ;
mycursor.execute('delete from '+TableName)
mydb.commit()
print('All the records are deleted...')

elif choice-5:
en-input('Enter employee no. of the record to be deleted...')
query='delete from '+TableName+' where empno =^ prime +en
mycursor.execute(query)
mydb.commit()
c-mycursor.rowcount
if c>0:
print('Deletion done')
else:
print('Employee no.',en, 'not found')

elif choice-6:
en-input('Enter employee no. of the record to be modified...')
query='select * from '+TableName+' where empno='+en
mycursor.execute(query)
myrecord=mycursor.fetchone()
c-mycursor.rowcount
if c==-1:
print('Empno '+en+' does not exist')
else:
print('empno :',myrecord[0])
print('name :',myrecord[1])
print('job :',myrecord[2])
print('BasicSalary :',myrecord[3])
print('DA :',myrecord[4])
print('HRA :',myrecord[5])
print('GrossSalary :',myrecord[6])
print('Tax :',myrecord[7])
print('NetSalary :',myrecord[8])
print('--------') import mysql.connector
import datetime
db=input("Enter name of your database:")
mydb=mysql.connector.connect(host='localhost',user='root,passwd=
'root)
mycurso=mydb.cursor()
sql="CREATE DATABASE if not exists os" % (db,)
mycursor.execute(sq)
print("Database created successfully...")
mycursorFmydb.cursor()
mycursor.execute("'use "+db)
TableName-input("Name of table to be created:")
query="Create table if not exists "+TableName+"\
(empno int primary key,\
name varchar(15) not null,)\)
job varchar(15),\
BasicSalary int,\
DA float,l HRA float,\
GrossSalary float,\
Tax float,\
NetSalary float)"
print("Table"+TableName+"created successfully....")
mycursor. execute(query)
print("\n')
print("*"*95)
print(\t\t\t\t\tPA YROLL MANAGEMENT SYSTEM ")
print("*"*95)
print(\n')
print("*"*95)
print(\t\t\t\t\tDEVELOPEDBY UZAIR SIDDIQUI')
print("*"*95)
print(n')
print("* "*95)
print(\t\tlt\t\tMAIN MENU')
print("* "*95)
print(\t\t\ttl. Adding Employee records')
print(\t\ltltlt2. For Displaying Record of All the Employees')
prínt(\t\tltit3. For Displaying Record of a particular Employee')
print(\ltltlt4. For deleting Record of all the Employees')
print("\t\t\t\t5. For Deleting a Record of a particular employees')
print("\t\t\t\t6. For Modification in a Record')
print("\t\t\t\t7. For exit')

while True:
print("Enter choice....",end=")
choice=int(input())
if choice-1:
print('Enter Employee information.....')
mempno=int(input('Enter employee no:')) mname=input('Enter
employee name:')
mjob input("Enter employee job:')
mbasic-float(input('Enter basic salary:'))
if mjob.upper()-'OFFICER':
mda-mbasic 0.5
mhra-mbasic*0.35
mtax-mbasic 0.2
elif mjob.upper()-' [ ANAGE * R' :
mda mbasic 0.45
mhra-mbasic 0.30
mtax-mbasic 0.15
else:
mda mbasic 0.40
mhra-mbasic 0.25
mtax-mbasic*0.1
mgross-mbasic+mda+mhra
mnet-mgross-mtax
rec (mempno,mname,mjob,mbasic,mda,mhra, mgross,mtax,mnet)
query="insert into "+TableName+" values
(%s, %s, %s, %s, %s, %s, %s, %s, %s)"
mycursor.execute(query,rec)
mydb.commit()
print('Record added successfully....')
elif(choice-2):
query="select from" +TableName
mycursor.execute(query)
myrecord=mycursor.fetchall()
print(myrecord)
elif choice-3:
en-input('Enter employee no. of the record to be displayed...')
query="select from "+TableName+" where empno="+en
mycursor.execute(query)
myrecord mycursor.fetchone()
print("\n\nrecord of Employee no.:"+en)
print(myrecord)
c-mycursor.rowcount
if c = - 1

print('Nothing to display')
elif choice-4:
ch-input('Do you want to delete all the records (y/n))
if ch.upper O=^ prime Y' ;
mycursor.execute('delete from '+TableName)
mydb.commit()
print('All the records are deleted...')

elif choice-5:
en-input('Enter employee no. of the record to be deleted...')
query='delete from '+TableName+' where empno =^ prime +en
mycursor.execute(query)
mydb.commit()
c-mycursor.rowcount
if c>0:
print('Deletion done')
else:
print('Employee no.',en, 'not found')

elif choice-6:
en-input('Enter employee no. of the record to be modified...')
query='select * from '+TableName+' where empno='+en
mycursor.execute(query)
myrecord=mycursor.fetchone()
c-mycursor.rowcount
if c==-1:
print('Empno '+en+' does not exist')
else:
print('empno :',myrecord[0])
print('name :',myrecord[1])
print('job :',myrecord[2])
print('BasicSalary :',myrecord[3])
print('DA :',myrecord[4])
print('HRA :',myrecord[5])
print('GrossSalary :',myrecord[6])
print('Tax :',myrecord[7])
print('NetSalary :',myrecord[8])
print('--------')
print('Type Value to modify below or just press Enter for no change')
x=input('Enter new Name=')
y=input('Enter new Post =^ prime )
query="UPDATE myroll SETname =\%s,job=\%s where empno
=%s"
value= (x, y, en)
mycursor.execute(query, value)
mydb.commit()
print('Record modified')
INTRODUCTION OF SOFTWARE:-

What is Software?
The term software is used for describing the all forms of programs
associated with computer, without software a computer is like a car
without an engine.
(1) System Software
(2) Application Software

SYSTEM SOFTWARE:-
The software, which are used to control and performance of the
computer system are known as system software of DOS, UNIX,
WINDOWS, LINUX etc.

APPLICATION SOFTWARE:-
Application programs may be provided by the computer
manufacturer or supplier but in many cases the user produces his
own application programs called user programs e.g. Travelling agency
Management. A single application program is often called a job.

CHARACTERSTICKS OF SOFTWARE:-
Organization developing complex application are now releasing that
is wise to invest time and with changes and upgrades in system and
hardware.
CHOICE OF SOFTWARE:-
For any project the most important part is the choice of the operating
system and application software we choose :-
a)Operating System- we choose WINDOW XP an operating system
because it is a device department operating system. This means that
no matter what printer you are using or no mater what should card is
used by user, another thing to use it that the user interface in the
same for all the

(b) window application. Therefore, we don't have to tell our user how
to operate the project.

(c)Application Software-we choose Python 3.6 as a front - end


because during design time, we are able to see how our program will
program will look during run time. This is the first advantage over
other programming language, because we are able to change and
experiment with our design until we are satisfied with the color, size
and image.

With this we choose MySql as à back end because of its compatibility


with Python 3.6 And data handling is easy in MySql.

SOFTWARE USED:-

• Window 10 etc. (Operating System).


• Python 3.6 (Programming Language).
• MySql Back End tool.
• Microsoft Word 2010 for help and documentation.
INTRODUCTION OF PYTHON

Python is a popular programming language. It was created by Guido


van Rossum, and released in 1991.
It is used for:
• web development (server-side),
• software development,
• mathematics,
• system scripting.

What can Python do?


• Python can be used on a server to create web applications.
• Python can be used alongside software to create workflows.
• Python can connect to database systems. It can also read and
modify files.
• Python can be used to handle big data and perform complex
mathematics.
• Python can be used for rapid prototyping, or for production-
ready software development.

Why Python?
• Python works on different platforms (Windows, Mac, Linux,
Raspberry Pi, etc).
• Python has a simple syntax similar to the English language.
• Python has syntax that allows developers to write programs
with fewer lines than some other programming languages.
• Python runs on an interpreter system, meaning that code can be
executed as soon as it is written. This means that prototyping
can be very quick
Good to know
• The most recent major version of Python is Python 3, which we
shall be using in this tutorial. However, Python 2, although not
being updated with anything other than security updates, is still
quite popular.
• In this tutorial Python will be written in a text editor. It is
possible to write Python in an Integrated Development
Environment, such as Thonny, Pycharm, Netbeans or Eclipse
which are particularly useful when managing larger collections
of Python files.

Python Syntax compared to other programming languages


• Python was designed for readability, and has some similarities
to the English language with influence from mathematics.
• Python uses new lines to complete a command, as opposed to
other programming languages which often use semicolons or
parentheses.
• Python relies on indentation, using whitespace, to define scope;
such as the scope of loops, functions and classes. Other
programming languages often use curly-brackets for this
purpose.
INTRODUCTION OF MYSQL

What is MySQL?

• MySQL is a database system used on the web


• MySQL is a database system that runs on a server
• MySQL is ideal for both small and large applications
• MySQL is very fast, reliable, and easy to use
• MySQL uses standard SQL
• MySQL compiles on a number of platforms
• MySQL is free to download and use
• MySQL is developed, distributed, and supported by Oracle
Corporation
• MySQL is named after co-founder Monty Widenius's daughter:
My
• The data in a MySQL database are stored in tables. A table is a
collection of related data, and it consists of columns and rows.
• Databases are useful for storing information categorically. A
company may have a database with the following tables:
• Employees
• Products
• Customers
• Orders
poorly designed database. A poorly design database tehds to
generates errors that are likely to bad decisions. A bad database
design
eventually can be self-correcting organization using poorly design
database often fail because their managers do have to timely
information, thereby
elimination the bad database design. Because the database is the
source from which information is generated. Its design is the
subject of detail study. Database design is simply too important to
be left to luck. That is why database is essential.

Models of Database Management System :-

(1) Hierarchical Model: Hierarchical database model represents


data in the form of record and trees representing relationship
among data. The users perceives the hierarchical database as a
hierarchical database of segment. A segment is the equivalent of
the file system record type.
(2) Network Model In the network database model the data
represented by collection of records and relationship among that
presented by links
(3) Relational Model Relational database model represents data
and relationship among the data by the collection of table, each
table consisting of number of columns with unique name. The
relational database is implemented through a very sophisticated
relational database management system

The main advantage of relational database is the ability to maintain


full independence between logical data description and
logical description. As consequence of this high-level of data
manipulation of data language may be consequences of this high-
level data manipulation language may be supported such languages
are free of programming for physical detail, thereby allowing the user
optimization to be done by system rather the user.
The promotion of relational database is also helped by database
language standardization in the form of standard structure query
language. SQL provides a uniform interface to all the users for data
definition control and manipulation. The three features that can
characterize the relational database model:

• The data structure are simple there are two dimensional tables
called relational whose elements are data items. Rows of relation are
columns as attributes relationships.
A set of eight operators such as:
(1) Union
(2) Intersection
(3)Select
(4)Project
(5)Join
(6) Difference

Is called relation algebra. It provides facilities to the data definition ,


data retrieval, and data updating. Each relation operator can take one
or more than one relation as input produces some specific outputs.
• Set of integrity constraint provided by the database. Relational task
group has proposed a definition of relational database system
Normalization :-

This is done in a series of steps, each of which leaves the model in a


specific normal form. Each normal form includes the constraints of
the previous normal form, so they must be applied in strict order.

Normalization generally deals with the first, second & third normal
forms respectively.

. First Normal Form- A relational is said to be in first normal for if all


underlying domains contains atomic values.

• Second Normal Form- A relational is said to be in second normal


form if it is first normal form and its every non key attribute is fully
functionally dependant on the primary key.

• Third Normal Form- A relational is said to be in third normal form if


it is second normal form and its every non key attribute is non
transitively dependant on the primary key.

You might also like