0% found this document useful (0 votes)
2K views4 pages

Student Management System in Python

This Python program is a student management system that allows users to insert, view, update, and delete student records from a database table. The program displays a menu where the user can select an option to perform the desired CRUD operation. Based on the choice, it connects to a MySQL database and executes the corresponding SQL query to manipulate the student data in the table.

Uploaded by

Om Tank
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)
2K views4 pages

Student Management System in Python

This Python program is a student management system that allows users to insert, view, update, and delete student records from a database table. The program displays a menu where the user can select an option to perform the desired CRUD operation. Based on the choice, it connects to a MySQL database and executes the corresponding SQL query to manipulate the student data in the table.

Uploaded by

Om Tank
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
  • System Setup
  • Record Search
  • Record Update
  • Record Deletion and Exit

Python Project – Student Management System

import pymysql
import os
exit='n'
while exit=='n':
    [Link]('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 = [Link]()
    if ch == 'I':
       
        connection=[Link](host="localhost", user="root", pass
wd="root", db="school")
        mycursor=[Link]()
        choice='y'
        while choice=='y':
        
            sno=input('enter the roll number of student ')
            sname=input('enter the name of student ')
            Qry = ("INSERT INTO class12 "\
                   "VALUES (%s, %s)") 
            data = (sno,sname) 
            [Link](Qry,data) 
            print('RECORD INSERTED SUCCESSFULLY')
            choice=input('do you with to insert more records (y/n)')
            if choice=='y':
                continue
            [Link]()
            [Link]()
    elif ch == 'V':

[Link]
Python Project – Student Management System
        
        connection=[Link](host="localhost", user="root", pass
wd="root", db="school")
        mycursor=[Link]()
        #[Link]("""create table class12 (rno int, name varch
ar(20))""")
        choice='y'
        while choice=='y':
        
            rno=int(input('enter the roll number of student whose reco
rd you want to search '))

            Qry = ("""select * from class12 WHERE rno = %s""") 
            data = (rno,) 
            [Link](Qry,data) 

            count=0
            for(rno,name)in mycursor:
                count+=1
                print('===========')
                print('Student Roll No  ',rno)
                print('Student Name     ',name)
                print('===========')
                if count%2==0:
                    print('press any key to continue')
                    clrscreen()
                print('total records',count,'found')
        
            choice=input('do you with to search more record(y/n)')
            if choice=='y':
                continue

            [Link]()
            [Link]()
    elif ch == 'U':
        

[Link]
Python Project – Student Management System
        connection=[Link](host="localhost", user="root", pass
wd="root", db="school")
        mycursor=[Link]()
        #[Link]("""create table class12 (rno int, name varch
ar(20))""")
        choice='y'
        while(choice=='y'):
        
            rno=int(input('enter the roll number of student whose reco
rd you want to change '))
            name=input('enter new name')

            Qry = ("""UPDATE class12 set name=%s WHERE rno = %s""") 
            data = (name,rno) 
            [Link](Qry,data) 
            print('RECORD UPDATED SUCCESSFULLY')
        
            choice=input('do you wish to update more records(y/n)')
            if choice=='y':
                continue
            [Link]()
            [Link]()
    elif ch == 'D':
        
        connection=[Link](host="localhost", user="root", pass
wd="root", db="school")
        mycursor=[Link]()
        #[Link]("""create table class12 (rno int, name varch
ar(20))""")
        choice='y'
        while choice=='y':
        
            rno=int(input('enter the roll number of student whose reco
rd you want to delete '))

            Qry = ("""DELETE FROM class12 WHERE rno = %s""") 
            data = (rno,) 

[Link]
Python Project – Student Management System
            [Link](Qry,data) 
            print('RECORD DELETED SUCCESSFULLY')
            choice=input('Do you wish to delete more records(y/n) ?')
            if choice=='y':
                continue
            [Link]()
            [Link]()
    elif ch == 'E':
        print("\n\t\t Thanks for using Student Management System...")
        print("\t\t-------------------------------------------")
        print("\t\t|   Created By - [Link]   |")
        print("\t\t-------------------------------------------")
        break
    else:
        print('\t\t\t Error : Not a Valid Option ')
        print('\t\t Valid option are "I", "V", "U", "D", or "E" only')
        exit=input('\t\t Do you wish to exit the program(y/n)')
        if exit=='n':
            continue

[Link]

Python Project – Student Management System
www.anjeevsinghacademy.com
import pymysql
import os
exit='n'
while exit=='n':
    
Python Project – Student Management System
www.anjeevsinghacademy.com
        
        connection=pymysql.connect(host="local
Python Project – Student Management System
www.anjeevsinghacademy.com
        connection=pymysql.connect(host="localhost", us
Python Project – Student Management System
www.anjeevsinghacademy.com
            mycursor.execute(Qry,data) 
            pri

You might also like