├── Backend └── dbbackend.py ├── Frontend └── frontendp.py ├── LICENSE └── README.md /Backend/dbbackend.py: -------------------------------------------------------------------------------- 1 | import sqlite3 2 | #backend 3 | def studentData(): 4 | con=sqlite3.connect("student.db") 5 | cur = con.cursor() 6 | cur.execute("CREATE TABLE IF NOT EXISTS student(id INTEGER PRIMARY KEY,StdID text, Firstname text, Surname text, DoB text,Age text, Gender text,Address text,Mobile text)") 7 | con.commit() 8 | con.close() 9 | 10 | def addStdRec(StdID, Firstname, Surname , DoB ,Age, Gender, Address, Mobile): 11 | con = sqlite3.connect("student.db") 12 | cur = con.cursor() 13 | cur.execute("INSERT INTO student VALUES (NULL,?,?,?,?,?,?,?,?) ", (StdID, Firstname,Surname,DoB,Age, Gender,Address,Mobile)) 14 | con.commit() 15 | con.close() 16 | 17 | def viewData(): 18 | con = sqlite3.connect("student.db") 19 | cur = con.cursor() 20 | cur.execute("SELECT * FROM student") 21 | rows = cur.fetchall() 22 | con.close() 23 | return rows 24 | 25 | def deleteRec(id): 26 | con = sqlite3.connect("student.db") 27 | cur = con.cursor() 28 | cur.execute("DELETE FROM student WHERE id=?",(id,)) 29 | con.commit() 30 | con.close() 31 | 32 | def searchData(StdID="", Firstname="", Surname="",DoB="", Age="", Gender="", Address="", Mobile=""): 33 | con = sqlite3.connect("student.db") 34 | cur = con.cursor() 35 | cur.execute("SELECT * FROM student WHERE StdID=? OR Firstname=? OR Surname=? OR DoB=? OR Age=? OR Gender=? OR Address=? OR Mobile=?",(StdID, Firstname,Surname,DoB,Age, Gender,Address,Mobile)) 36 | rows = cur.fetchall() 37 | con.close() 38 | return rows 39 | 40 | def dataUpdate(id,StdID="", Firstname="", Surname="",DoB="", Age="", Gender="", Address="", Mobile=""): 41 | con = sqlite3.connect("student.db") 42 | cur = con.cursor() 43 | cur.execute("UPDATE student SET StdID=?, Firstname=?, DoB=?,Age=?,Address=?Mobile=?,WHERE id=?", (StdID, Firstname, Surname, DoB, Age, Gender, Address, Mobile, id)) 44 | con.commit() 45 | con.close() 46 | 47 | studentData() 48 | -------------------------------------------------------------------------------- /Frontend/frontendp.py: -------------------------------------------------------------------------------- 1 | #frontend 2 | from tkinter import * 3 | import tkinter.messagebox 4 | import dbbackend 5 | class Student: 6 | 7 | def __init__(self,root): 8 | self.root =root 9 | self.root.title("Student Database Management System") 10 | self.root.geometry("1350x750+0+0") 11 | self.root.config(bg="cadet blue") 12 | 13 | StdID = StringVar() 14 | Firstname = StringVar() 15 | Surname = StringVar() 16 | DoB = StringVar() 17 | Age = StringVar() 18 | Gender = StringVar() 19 | Address = StringVar() 20 | Mobile = StringVar() 21 | # --------------------------------------FUNCTIONS------------------------------------------------------------------- 22 | def iExit(): 23 | iExit = tkinter.messagebox.askyesno("Student Database Management Systems", "Confirm if you want to exit") 24 | if iExit > 0: 25 | root.destroy() 26 | return 27 | def clearData(): 28 | self.txtStdID.delete(0, END) 29 | self.txtfna.delete(0, END) 30 | self.txtSna.delete(0, END) 31 | self.txtDoB.delete(0, END) 32 | self.txtAge.delete(0, END) 33 | self.txtGender.delete(0, END) 34 | self.txtAdr.delete(0, END) 35 | self.txtMobile.delete(0, END) 36 | def addData(): 37 | if(len(StdID.get())!=0): 38 | dbbackend.addStdRec(StdID.get(), Firstname.get(), Surname.get() , DoB.get() ,Age.get(), Gender.get(), Address.get(), Mobile.get()) 39 | studentlist.delete(0, END) 40 | studentlist.insert(END, (StdID.get(), Firstname.get(), Surname.get(), DoB.get(), Age.get(), Gender.get(), Address.get(), Mobile.get())) 41 | 42 | def DisplayData(): 43 | studentlist.delete(0,END) 44 | for row in dbbackend.viewData(): 45 | studentlist.insert(END, row, str("")) 46 | 47 | def StudentRec(event): 48 | global sd 49 | searchStd= studentlist.curselection()[0] 50 | sd = studentlist.get(searchStd) 51 | 52 | self.txtStdID.delete(0, END) 53 | self.txtStdID.insert(END, sd[1]) 54 | self.txtfna.delete(0, END) 55 | self.txtfna.insert(END, sd[2]) 56 | self.txtSna.delete(0, END) 57 | self.txtSna.insert(END, sd[3]) 58 | self.txtDoB.delete(0, END) 59 | self.txtDoB.insert(END, sd[4]) 60 | self.txtAge.delete(0, END) 61 | self.txtAge.insert(END, sd[5]) 62 | self.txtGender.delete(0, END) 63 | self.txtGender.insert(END, sd[6]) 64 | self.txtAdr.delete(0, END) 65 | self.txtAdr.insert(END, sd[7]) 66 | self.txtMobile.delete(0, END) 67 | self.txtMobile.insert(END, sd[8]) 68 | 69 | def DeleteData(): 70 | if(len(StdID.get())!=0): 71 | dbbackend.deleteRec(sd[0]) 72 | clearData() 73 | DisplayData() 74 | 75 | def searchDatabase(): 76 | studentlist.delete(0,END) 77 | for row in dbbackend.searchData(StdID.get(), Firstname.get(), Surname.get() , DoB.get() ,Age.get(), Gender.get(), Address.get(), Mobile.get()): 78 | studentlist.insert(END, row, str("")) 79 | 80 | def update(): 81 | if (len(StdID.get()) != 0): 82 | dbbackend.deleteRec(sd[0]) 83 | if (len(StdID.get()) != 0): 84 | dbbackend.addStdRec(StdID.get(), Firstname.get(), Surname.get(), DoB.get(), Age.get(), Gender.get(),Address.get(), Mobile.get()) 85 | studentlist.delete(0, END) 86 | studentlist.insert(END, (StdID.get(), Firstname.get(), Surname.get(), DoB.get(), Age.get(), Gender.get(), Address.get(), Mobile.get())) 87 | #--------------------------------------Frames-----------------------------------------------------------------------__________________________________________________________ 88 | MainFrame = Frame(self.root, bg="cadet blue") 89 | MainFrame.grid() 90 | TitFrame = Frame(MainFrame, bd=2, padx=54,pady=8, bg="Ghost White", relief=RIDGE) 91 | TitFrame.pack(side=TOP) 92 | self.lblTit = Label(TitFrame ,font=('times new roman',48,'bold'),text="Student Database Management System",bg="Ghost White") 93 | self.lblTit.grid() 94 | ButtonFrame =Frame(MainFrame,bd=2,width=1350,height=70,padx=19,pady=10,bg="Ghost White",relief =RIDGE) 95 | ButtonFrame.pack(side=BOTTOM) 96 | DataFrame = Frame(MainFrame, bd=1, width=1300, height=400, padx=20, pady=20, relief=RIDGE,bg="cadet blue") 97 | DataFrame.pack(side=BOTTOM) 98 | DataFrameLEFT = LabelFrame(DataFrame, bd=1, width=1000, height=600, padx=20,relief=RIDGE,bg="Ghost White", font=('times new roman',26,'bold'),text="Student Info\n") 99 | DataFrameLEFT.pack(side=LEFT) 100 | DataFrameRIGHT = LabelFrame(DataFrame, bd=1, width=450, height=300, padx=31, pady=3, relief=RIDGE,bg="Ghost White",font=('times new roman',20,'bold'),text="Student Details\n") 101 | DataFrameRIGHT.pack(side=RIGHT) 102 | #--------------------------------entries------------------------------------------------------------------------------------------------- 103 | self.lblStdID = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Student ID:",padx=2,pady=2,bg="Ghost White") 104 | self.lblStdID.grid(row=0,column=0,sticky=W) 105 | self.txtStdID = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=StdID, width=39) 106 | self.txtStdID.grid(row=0, column=1) 107 | 108 | self.lblfna = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Firstname:", padx=2, pady=2,bg="Ghost White") 109 | self.lblfna.grid(row=1, column=0, sticky=W) 110 | self.txtfna = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Firstname, width=39) 111 | self.txtfna.grid(row=1, column=1) 112 | 113 | self.lblSna = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Surname:", padx=2, pady=2,bg="Ghost White") 114 | self.lblSna.grid(row=2, column=0, sticky=W) 115 | self.txtSna = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Surname, width=39) 116 | self.txtSna.grid(row=2, column=1) 117 | 118 | self.lblDoB = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Date of Birth:", padx=2, pady=2,bg="Ghost White") 119 | self.lblDoB.grid(row=3, column=0, sticky=W) 120 | self.txtDoB = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=DoB, width=39) 121 | self.txtDoB.grid(row=3, column=1) 122 | 123 | self.lblAge = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Age:", padx=2, pady=2,bg="Ghost White") 124 | self.lblAge.grid(row=4, column=0, sticky=W) 125 | self.txtAge = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Age, width=39) 126 | self.txtAge.grid(row=4, column=1) 127 | 128 | self.lblGender = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Gender:", padx=2, pady=2,bg="Ghost White") 129 | self.lblGender.grid(row=5, column=0, sticky=W) 130 | self.txtGender = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Gender, width=39) 131 | self.txtGender.grid(row=5, column=1) 132 | 133 | self.lblAdr = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Address:", padx=2, pady=2,bg="Ghost White") 134 | self.lblAdr.grid(row=6, column=0, sticky=W) 135 | self.txtAdr = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Address, width=39) 136 | self.txtAdr.grid(row=6, column=1) 137 | 138 | self.lblMobile = Label(DataFrameLEFT, font=('times new roman', 20, 'bold'), text="Mobile:", padx=2, pady=2,bg="Ghost White") 139 | self.lblMobile.grid(row=7, column=0, sticky=W) 140 | self.txtMobile = Entry(DataFrameLEFT, font=('times new roman', 20, 'bold'), textvariable=Mobile, width=39) 141 | self.txtMobile.grid(row=7, column=1) 142 | #--------------------------------------scroll bar and list box---------------------------------------------------------------------------- 143 | scrollbar= Scrollbar(DataFrameRIGHT) 144 | scrollbar.grid(row=0,column=1,sticky='ns') 145 | 146 | studentlist = Listbox(DataFrameRIGHT, width=41, height=16, font=('times new roman', 12, 'bold'),yscrollcommand=scrollbar.set) 147 | studentlist.bind('<>',StudentRec) 148 | studentlist.grid(row=0, column=0, padx=8) 149 | scrollbar.config(command=studentlist.yview) 150 | #--------------------------------------buttons----------------------------------------------------------------------------------------------------------- 151 | self.btnAddData = Button(ButtonFrame, text="Add New", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4, command=addData) 152 | self.btnAddData.grid(row=0, column =0) 153 | 154 | self.btnDisplayData = Button(ButtonFrame, text="Display", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4, command=DisplayData) 155 | self.btnDisplayData.grid(row=0, column=1) 156 | 157 | self.btnClearData = Button(ButtonFrame, text="Clear", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4,command=clearData) 158 | self.btnClearData.grid(row=0, column=2) 159 | 160 | self.btnDeleteData = Button(ButtonFrame, text="Delete", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4,command=DeleteData) 161 | self.btnDeleteData.grid(row=0, column=3) 162 | 163 | self.btnSearchData = Button(ButtonFrame, text="Search", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4,command=searchDatabase) 164 | self.btnSearchData.grid(row=0, column=4) 165 | 166 | self.btnUpdateData = Button(ButtonFrame, text="Update", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4,command=update) 167 | self.btnUpdateData.grid(row=0, column=5) 168 | 169 | self.btnExit = Button(ButtonFrame, text="Exit", font=('times new roman', 20, 'bold'), height=1, width=10, bd=4, command=iExit) 170 | self.btnExit.grid(row=0, column=6) 171 | 172 | if __name__=='__main__': 173 | root = Tk() 174 | application = Student(root) 175 | root.mainloop() 176 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 SASWAT SARANGI 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Student-Database-Management-System 2 | This is project of our sophomore project of Data Base Management System made using Python and Sqlite. 3 | In this student database management system we can add, delete,update,view and clear existing records from the database. 4 | Here Student ID acts as the PRIMARY KEY and we store Student name,age,gender,address and mobile number.
5 | Here are some of the screenshots of the frontend: 6 |
7 | ![Screenshot (47)](https://user-images.githubusercontent.com/45651397/78636372-d96e5b00-78c5-11ea-93ee-c195c5b8ee9a.png) 8 |
9 | Here Add new- Adds new informtion related to student.
10 | Clear- clears the entry box for new entries.
11 | Search- Enter any keyword in the query box and search will show you the relevant results.
12 | Update- Updates any changes applied to that particular given user.
13 | Delete- Deletes the entire dataset selected.
14 | Display- Views the entries till date.
15 | Here is how the Exit button works:
16 |
17 | ![Screenshot (48)](https://user-images.githubusercontent.com/45651397/78637910-f7898a80-78c8-11ea-8f47-44dba9b0ae74.png) 18 |
19 | If we press 'Yes' it will exit the process and if we press 'No' it will return to process.
20 | This project was undertaken under the guidance of Dr. Brij Bihari Dubey of the Database Management Systems.
21 | Language used: Python 3
22 | Query Language used: Sqlite 3
23 | Library:Tkinter
24 | Other concepts involved: Object Oriented Programming(OOPS) 25 | 26 | 27 | --------------------------------------------------------------------------------