Python Project

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

Internal Examiner External Examiner

Principal Head of the Department


8 Python and SQL

9 Source Code

10 Sample Outputs

11 Conclusion

12 Bibliography

ACKNOWLEDGEMENT

My endeavor incomplete without dedicating my gratitude to the people who have


contributed a lot towards the successful completion of my project. I offer my humble
gratitude to the Amma, Sri.MataAmritanandamayi Devi who has been source of love,
grace and moral support.
I express my deep sense thanks of obligation to BrahmachariniSreelatha T.S,
the principal of our school.andSri. SunilKumar MThe academic advisor of our school
who has a great source of inspiration for completing this project.

I am greatly indebted to Mrs. Krishna N S, teacher in computer science for her


expert guidance and support throughout the completion of this project.

Last but not least , I would like to thank almighty, my parents, brothers, sisters and
friends for their constant encouragement without whom the project could not have been
finished successfully.
PROJECT
ON
STUDENT MANAGEMENT SYSTEM

INTRODUCTION
Student Management System project is written in Python language and SQL is
used for database connection. This is a simple console based system which is very
easy to understand and use. Talking about the system, it contains all the basic
functions which include insert new student details, view student’s details that
already exists, update or we can modify student details also deletion function is
there to delete the student details that no more exist. It is too easy to use; he/she
can check the total student records easily. This project is multifield project, so that
it can be modified for various purposes. The main object of this system is to
provide a secure system.

OBJECTIVES OF THE PROJECT


The objective of this project is to
 Let the students apply the programming knowledge into a real- world
situation/problem and exposed the students how programming skills helps in
developing a good software.
 Write programs utilizing modern software tools.
 Apply object oriented programming principles effectively when developing
small to medium sized projects.
 Implementing strong security measure to protect sensitive financial data.

SCOPE OF THE PROJECT


 User friendly interface
 Fast access to database
 Less error
 More Storage Capacity Search facility
 Look and Feel Environment

EXISTING SYSTEM
In the current system we need to keep a number of records related to the student
and want to enter the details of the student and the marks manually. In this system
only the teacher or the school authority views the mark of the student and they
want to enter the details of the student. This is time consuming and has much cost.

1. Import MySQL connector module. ...


2. Use the connect() method. ...
3. Use the cursor() method. ...
4. Use the execute() method. ...
5. Extract result using fetchall() ...
6. Close cursor and connection objects.

Example
Following is the example of connecting with MySQL database "TESTDB"
#!/usr/bin/python

importMySQLdb

# Open database connection


db=MySQLdb.connect("localhost","testuser","test123","TESTDB")

# prepare a cursor object using cursor() method


cursor=db.cursor()

# execute SQL query using execute() method.


cursor.execute("SELECT VERSION()")

# Fetch a single row using fetchone() method.


data=cursor.fetchone()
print"Database version : %s "% data

# disconnect from server


db.close()

READ Operation.
 fetchone() − It fetches the next row of a query result set. A result set is an object that is
returned when a cursor object is used to query a table.
 fetchall() − It fetches all the rows in a result set. If some rows have already been
extracted from the result set, then it retrieves the remaining rows from the result set.
 rowcount − This is a read-only attribute and returns the number of rows that were
affected by an execute() method.

Source code
importos

import platform

importmysql.connector

mydb=mysql.connector.connect(host="localhost",user="root",password="ammaamrita")

mycursor=mydb.cursor()

mycursor.execute("create database if not exists school")

mycursor.execute("use school")

exit='n'

while exit=='n':

os.system('cls')

print('-' * 90)

print('|'+' '*31+'STUDENT MANAGEMENT SYSTEM'+' ' * 32+ '|')

print('-' * 90)

print('| [I]nsert Record |', end='')

print(' [V]iew Record |', end='')

print(' [U]pdate Record |',end='')

print(' [D]elete Record |',end='')

print(' [E]XIT |')

print('-' * 90)

ch=input('YOUR Choice (I/V/U/D/E):')

ch = ch.upper()

ifch == 'I':
mydb=mysql.connector.connect(host="localhost", user="root", passwd="ammaamrita",
db="school")

mycursor=mydb.cursor()

choice='y'

while choice=='y':

sno=input('enter the roll number of student ')

sname=input('enter the name of student ')

print(" Creating Parkmaster12 table")

mycursor.execute("create table if not exists class12 (rnoint, name varchar(20))")

Qry = ("INSERT INTO class12 "\

"VALUES (%s, %s)")

data = (sno,sname)

mycursor.execute(Qry,data)

print('RECORD INSERTED SUCCESSFULLY')

choice=input('do you with to insert more records (y/n)')

if choice=='y':

continue

mydb.commit()

mydb.close()

elifch == 'V':

mydb=mysql.connector.connect(host="localhost", user="root", passwd="ammaamrita", db="school")

mycursor=mydb.cursor()

#mycursor.execute("""create table class12 (rnoint, name varchar(20))""")


choice='y'

while choice=='y':

rno=int(input('enter the roll number of student whose record you want to search '))

Qry = ("""select * from class12 WHERE rno = %s""")

data = (rno,)

mycursor.execute(Qry,data)

count=0

You might also like