Answered step by step
Verified Expert Solution
Question
1 Approved Answer
USE student _ registration _ system; CREATE TABLE departments ( department _ id INT PRIMARY KEY AUTO _ INCREMENT, department _ name VARCHAR ( 1
USE studentregistrationsystem;
CREATE TABLE departments
departmentid INT PRIMARY KEY AUTOINCREMENT,
departmentname VARCHAR
;
CREATE TABLE students
studentid INT PRIMARY KEY AUTOINCREMENT,
firstname VARCHAR
lastname VARCHAR
departmentid INT,
FOREIGN KEY departmentid REFERENCES departmentsdepartmentid
;
CREATE TABLE registrations
registrationid INT PRIMARY KEY AUTOINCREMENT,
studentid INT,
courseid INT,
registrationdate DATE,
FOREIGN KEY studentid REFERENCES studentsstudentid
FOREIGN KEY courseid REFERENCES coursescourseid
; BASED ON THE RELATION DATABASE PROVIDED ABOVE, CREATE CODES FOR STUDENT REGISTRATION SYSTEM THAT WILL CREATE A GUI USING THE BELLOW INFORMATION. GIVE COMPLETE CODES AND ALSO GIVE COMPLETE CODES FOR INSERT,DELETE,UPDATE AND GET FUNCTIONS. Give correct codes for each step and DESCRIBE THE FUNCTIONALITY. NOTE: USE Python and MySQL workbeanch mycursor mydbcursor
def insert:
firstname efirstname.get
lastname elastname.get
departmentid edepartmentidget
if firstname or lastname or departmentid :
messagebox.showinfoInsert status", "All fields are required"
else:
mycursor.executeINSERT INTO students firstname, lastname, departmentid VALUES sss
firstname, lastname, departmentid
mydbcommit
efirstname.delete 'end'
elastname.delete 'end'
edepartmentiddelete 'end'
messagebox.showinfoInsert status", "Insert successful"
def delete:
studentidtodelete getstudentid
if studentidtodelete is not None:
mycursor.executeDELETE FROM students WHERE studentid sstudentidtodelete,
mydbcommit
messagebox.showinfoDelete status", "Deletion successful"
def update:
studentidtoupdate getstudentid
if studentidtoupdate is not None:
firstname efirstname.get
lastname elastname.get
departmentid edepartmentidget
mycursor.executeUPDATE students SET firstnames lastnames departmentids WHERE studentids
firstname, lastname, departmentid studentidtoupdate
mydbcommit
messagebox.showinfoUpdate status", "Update successful"
def get:
studentidtofetch getstudentid
if studentidtofetch is not None:
mycursor.executeSELECT FROM students WHERE studentid sstudentidtofetch,
rows mycursor.fetchall
for row in rows:
efirstname.insert row
elastname.insert row
edepartmentidinsert row
messagebox.showinfoGet status", "Fetch successful"
def getstudentid:
studentid entrystudentidget
return studentid
root Tk
root.geometryx
root.titleSTUDENT REGISTRATION SYSTEM"
firstnamelabel Labelroot text'First Name', fontbold
firstnamelabel.placex y
lastnamelabel Labelroot text'Last Name', fontbold
lastnamelabel.placex y
departmentidlabel Labelroot text'Department ID fontbold
departmentidlabel.placex y
entrystudentid Entry
entrystudentidplacex y
efirstname Entry
efirstname.placex y
elastname Entry
elastname.placex y
edepartmentid Entry
edepartmentidplacex y
insertbutton Buttonroot text"Insert", fontitalic bg"white", commandinsert
insertbutton.placex y
deletebutton Buttonroot text"Delete", fontitalic bg"white", commanddelete
deletebutton.placex y
updatebutton Buttonroot text"Update", fontitalic bg"white", commandupdate
updatebutton.placex y
getbutton Buttonroot text"Get", fontitalic bg"white", commandget
getbutton.placex y
root.mainloop
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started