Project SQL
Project SQL
Project SQL
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
Teachers signature
ACKNOWLEDGEMENT
RAM 4 GB RAM
PROCESSOR Dual core, 1.70 GHz
HARD DISK 320 GB
MONITOR SVGA (COLOR MONITOR)
CD-DRIVE SAMSUNG 52X MAX
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.
SOFTWARE USED:-
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.
What is MySQL?
• 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
Normalization generally deals with the first, second & third normal
forms respectively.