0% found this document useful (0 votes)
44 views

Project Front End and Back End

This document is a certificate stating that a student named Chahal Jain has successfully completed a school management system project in partial fulfillment of their CBSE curriculum. The project uses Python, IDLE, MySQL, and involves creating databases and tables to store and manage student records, teacher details, fees, and library information for a school. It allows users to view, add, update and manipulate student and other data.

Uploaded by

Vartika Vashista
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
44 views

Project Front End and Back End

This document is a certificate stating that a student named Chahal Jain has successfully completed a school management system project in partial fulfillment of their CBSE curriculum. The project uses Python, IDLE, MySQL, and involves creating databases and tables to store and manage student records, teacher details, fees, and library information for a school. It allows users to view, add, update and manipulate student and other data.

Uploaded by

Vartika Vashista
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

Certificate

This is to inform you that the Computer Science project on “ School


Management System” has been successfully completed by CHAHAL
JAIN of Class XII Science in Partial fulfilment of the curriculum of the
central Board of Education (CBSE)

Ms. VINITA DHAWAN


(P.G.T. Computer Science)

Project Front end and back end


IDLE PYTHON

MYSQL

INTRODUCTION
This is a project based on School Management System. The program
helps us to enter, display or alter the details of the students of the school.
Moreover & most importantly the program helps us to know the present
details of the students.
It includes various function programs to do the above mentioned tasks.

OBJECTIVE
The main object of the SCHOOL MANAGEMENT SYSTEM is to
reduce time, to provide the details of students like roll number,
admission number etc.
It manages all the information about students.
Program
Description
A school management system to record the system of students
admission,student record entry and fee deposit that involves several
entities relating to new admission of students of school and enter
students records and display, manipulate and also can record students fee
details.Thus recording of entries becomes easy and the expenditure
incurred in the working of the organisation can be easily derived
MySQL

MyQL is an open-source relational database management system. It


allows users to interact a MySQL database directly using SQL, but more
often, MySQL is used with other programs to implement applications
that need relational database management, MySQL also enables Python
programs to access MySQL databases.
BIBLIOGRAPHY

Books Referred:
● Sumita Arora class XII
Sites Referred:
● www.tutorialspoint.com
● www.geeksforgeeks.org
● www.wikipedia.com

INDEX
● Coverpage
● Certificate
● Acknowledgement
● Hardware and software requirements
● Front and back end
● Introduction
● Objective
● Program description
● MySQL description
● MySQL introduction
● MySQL table structure with records
● Coding
● Output
● Bibliography

Teacher's signature:

Hardware and software requirements:

Software specifications :-
● Operating system: window 10 pro
● Platform : python idle 3.10.2
● Databse :MySQL
● Language :python

Hardware specifications:-
● Processor :Intel core i 5
● Hard disk 550 gb SSD
● Ram : 16 gb ddr4

coding

import mysql
import mysql.connector as oxo
from tabulate import tabulate

con = oxo.connect(host="localhost",
user="root",
password"ss",
charset="utf8")
cur = con.cursor()
def show():
print(
"\t------------------------------------\n\tWELCOME TO SCHOOL MANAGEMENT SYSTEM\t\n\t----------"
"--------------------------")
print("1.STUDENT MANAGEMENT")
print("2.TEACHER MANAGEMENT")
print("3.FEES MANAGEMENT")
print("4.LIBRARY MANAGEMENT")
print("5:DROP DATABASE")
print("6.Exit")
def create_database():
cur.execute("CREATE DATABASE IF NOT EXISTS School_2")
cur.execute("USE SCHOOL_2")
cur.execute("""
create table if not exists STUDENT(
ROLLNO INT primary key,
NAME VARCHAR(50),
CLASS VARCHAR(10),
Physics INT not null,
Chemistry INT not null,
Math INT not null,
English INT not null,
Computer INT not null,
tot_percentage decimal(8,3),
tot_marks int not null,
grade varchar(2)
cur.execute("""
create table if not exists TEACHER(
SNO int NOT NULL auto_increment primary key,
NAME VARCHAR(100),
SUB VARCHAR(50),
SALARY INT)
""")
cur.execute("""
create table if not exists student_teacher (
SNO int NOT NULL auto_increment primary key,
student_id int not null,
teacher_id int not null,
foreign key (student_id) references Student(rollno),
foreign key (teacher_id) references Teacher(SNO)
)
""")
cur.execute("""
create table if not exists
FEES(
SNO int NOT NULL auto_increment primary key,
SCHOOLFEE INT,
BUSFEE INT,
STUDENT_ID INT,
FEES_PAID bool,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
foreign key (STUDENT_ID) references STUDENT(ROLLNO) )
""")

cur.execute("""
create table if not exists LIBRARY(
SNO int NOT NULL auto_increment primary key,
BName varchar(50) not null,
AUTHOR VARCHAR(12),
PRICE INT,
student_id int,
submitted_by_student bool,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
foreign key (student_id) references student(rollno)
)
""")
# print(f" {'-' * 10 } All related databases and tables are created successfully {'-' * 10 } ")

create_database()
show()
# drop database
def drop_database():
cur.execute("DROP DATABASE IF EXISTS School_2")
con.commit()
print(" Database school_2 is cleaned successfully ")
# Student Database

def adddata_S():
while True:
rollno = int(input("Enter roll no of student:"))
name = input("Enter name of student:")
Class = input("Enter class of student:")
physics = int(input("Enter physics marks of student:"))
chemistry = int(input("Enter chemistry marks of student:"))
maths = int(input("Enter maths marks of student:"))
english = int(input("Enter english marks of student:"))
computer = int(input("Enter computer marks of student:"))
tot_marks = physics + chemistry + english + computer + maths
tot_percentage = (tot_marks/500) * 100
grade = "E"
if 91 <= tot_percentage <= 100:
grade = "A1"
if 81 <= tot_percentage < 91:
grade = "A2"
if 71 <= tot_percentage < 81:
grade = "B1"
if 61 <= tot_percentage < 71:
grade = "B2"
if 51 <= tot_percentage < 61:
grade = "C1

if 41 <= tot_percentage < 51:


grade = "C2"
if 31 <= tot_percentage < 41:
grade = "D"

query = "Insert into student(rollno,name,Class,physics, " \


"chemistry, math, english, computer, tot_percentage, tot_marks, grade) " \
"values({},'{}','{}',{}, {}, {}, {}, {}, {}, {}, '{}')" \
"".format(rollno, name, Class, physics, chemistry, maths, english, computer,
tot_percentage, tot_marks, grade)
cur.execute(query)
con.commit()
print("Values Added..")
ch = input("You want to enter more (y/n) : ")
if ch == 'n' or ch == 'N':
break

def fetchdata_S():
try:

cur.execute("SELECT * FROM STUDENT")


results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))
# for x in results:
# print(f"Roll Number : {x[0]} \n Name :{x[1]} \n Class :{x[2]} \n Total Marks :{x[3]} \n : ")
print("Total no. of Students :", cur.rowcount)
except mysql.connector.Error as err:
print(f"ERROR:UNABLE TO FETCH DATA : {err}")

def updatedata_S():
roll_number = int(input("Enter the roll number :"))
update = True
field_update = int(input("\n Which field you want to update : \n 1: Name \n 2: Class \n 3: Marks \n "))
if field_update == 1:
field = "name"
value = input("Enter the new name : ")
elif field_update == 2:
field = "class"
value = input("Enter the new class : ")
elif field_update == 3:
field_update = int(input("\n Which subject marks you want to update :"
" \n 1: Physics \n 2: Maths \n 3: Chemistry \n "
" 4: English \n 5: Computer \n"))
if field_update == 1:
field = "physics"
value = int(input("Enter the new physics marks : "))
elif field_update == 2:
field = "math"
value = int(input("Enter the new maths marks : "))
elif field_update == 3:
field = "chemistry"
value = int(input("Enter the new chemistry marks : "))
elif field_update == 4:
field = "english"
value = int(input("Enter the new english marks : "))
elif field_update == 5:
field = "computer"
value = int(input("Enter the new computer marks : "))
else:
print("bad choice \n exiting to main menu")
update = False
if update:
cur.execute(
"SELECT {},tot_percentage, tot_marks, grade FROM STUDENT where rollno={}".format(field, roll_number)
)
recs = cur.fetchone()
print("current marks: \n")
print(tabulate([recs], headers=[i[0] for i in cur.description], tablefmt='psql'))
tot_marks = recs[2]
tot_marks -= recs[0]
tot_marks += value
tot_percentage = (tot_marks / 500) * 100
grade = "E"
if 91 <= tot_percentage <= 100:
grade = "A1"
if 81 <= tot_percentage < 91:
grade = "A2"
if 71 <= tot_percentage < 81:
grade = "B1"
if 61 <= tot_percentage < 71:
grade = "B2"
if 51 <= tot_percentage < 61:
grade = "C1"
if 41 <= tot_percentage < 51:
grade = "C2"
if 31 <= tot_percentage < 41:
grade = "D"
try:
sql = "update student set {}={}, {}={}, {}={}, {}='{}' where rollno = {}".format(
field, value, 'tot_percentage', tot_percentage, 'tot_marks', tot_marks,
'grade', grade, roll_number)
cur.execute(sql)
print("Marks updated")
con.commit()
except Exception as e:
print(e)

update = False
else:
print("bad choice \n exiting to main menu")
update = False
if update:
try:

if field == "tot_marks":
sql = "update student set {} = {} where rollno = {} ".format(field, value, roll_number)
else:
sql = "update student set {} = '{}' where rollno = {} ".format(field, value, roll_number)
cur.execute(sql)
print("Records updated")
con.commit()
except Exception as e:
print(e)
def deldata_S():
cursor = con.cursor()
roll_no = int(input("Enter the rollno to be deleted : "))
try:
query = " delete from student where rollno = {} ".format(roll_no)
cursor.execute(query)
con.commit()
print(" Deletion Successfull .. ")

except Exception as e:
print(e)

def fetchdata_S_specific():
try:

roll_num = int(input("Enter the student roll number : "))


cur.execute("SELECT * FROM STUDENT where rollno={}".format(roll_num))
results = cur.fetchall()
print("Student info : \n")
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))

print(" Student 's Teachers Info")


cur.execute(
"Select t.name, t.sub from student_teacher st join teacher t where st.student_id = {}".format(roll_num))
results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))

print("Student 's Library Details")

cur.execute("Select bname, author from Library where student_id = {} order by updated_at desc".format(roll_num))
results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))
print(f"Total Books Issued for roll number : {roll_num} = {len(results)}")

print("Student 's Fee Details ")


cur.execute(
"Select schoolfee, busfee, fees_paid from fees where student_id = {} order by updated_at desc".format(
roll_num))
results = cur.fetchall()

print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))

except mysql.connector.Error as err:


print(f"ERROR:UNABLE TO FETCH DATA : {err}")

def update_S_teacher_info():
try:

student_id = int(input("Enter the student id for which you want to assign teachers : "))
teacher_id = int(input("Enter the teacher id you want to assign to following student : "))

cur.execute("INSERT INTO student_teacher (student_id, teacher_id) "


"VALUES({}, {}) ON DUPLICATE KEY UPDATE student_id={}, teacher_id={}".format(student_id,
teacher_id,
student_id,
teacher_id))

print(f"rows update/created : {cur.rowcount}")


con.commit()
except mysql.connector.Error as err:
print(f"ERROR:Please check if student id and teacher id both exist in their respective table : {err}")

def menu_S():
while True:
print("1 ADD RECORD")
print("2 UPDATE RECORD")
print("3 DELETE RECORD")
print("4 DISPLAY RECORD")
print("5 DISPLAY SPECIFIC STUDENT DETAILS")
print("6 UPDATE STUDENT 'S TEACHER ")
print("7 EXIT")
choice_S = int(input("ENTER YOUR CHOICE:"))
if choice_S == 1:
adddata_S()
elif choice_S == 2:
updatedata_S()
elif choice_S == 3:
deldata_S()
elif choice_S == 4:
fetchdata_S()
elif choice_S == 5:
fetchdata_S_specific()
elif choice_S == 6:
update_S_teacher_info()
elif choice_S == 7:
print("EXIT")
break
else:
print("WRONG INPUT")

c_S = input("DO YOU WANT TO CONTINUE OR NOT:")


if c_S == 'n' or c_S == 'N':
break

# For Teacher

def adddata_T():
while True:
try:
name = input("Enter name of Teacher:")
sub = input("Enter Subject of Teacher:")
salary = float(input("Enter Salary of Teacher:"))
query = "Insert into teacher(name,sub,salary) values('{}','{}',{})".format(name, sub, salary)
cur.execute(query)
con.commit()
print("Values Added..")
ch = input("You want to enter more:")
if ch == 'n' or ch == 'N':
break
except Exception as e:
print(e)

def fetchdata_T():
try:

cur.execute("SELECT*FROM TEACHER")
results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))
print("Total no. of records:", cur.rowcount)
except:
print("ERROR:UNABLE TO FETCH DATA")

def updatedata_T():
s_no = int(input("Enter the sno for teacher : "))
update = True
field_update = int(input("\n Which field you want to update : \n 1: Name \n 2: subject \n 3: Salary \n "))
if field_update == 1:
field = "name"
value = input("Enter the new name : ")
elif field_update == 2:
field = "sub"
value = input("Enter the new Subject : ")
elif field_update == 3:
field = "salary"
value = int(input("Enter the new salary : "))
else:
print("bad choice \n exiting to main menu")
update = False
if update:
try:

if field == "salary":
sql = "update teacher set {} = {} where sno = {} ".format(field, value, s_no)
else:
sql = "update teacher set {} = '{}' where sno = {} ".format(field, value, s_no)
cur.execute(sql)
print("Records updated: ", cur.rowcount)
con.commit()
except Exception as e:
print(e)

def deldata_T():
sno = int(input("Enter the sno to be deleted :"))

cursor = con.cursor()
try:
query = " delete from teacher where sno = {} ".format(sno)
cursor.execute(query)
con.commit()
print(" Deletion Successfull .. ")

except Exception as e:
print(e)

def menu_T():
while True:
print("1 ADD RECORD")
print("2 UPDATE RECORD")
print("3 DELETE RECORD")
print("4 DISPLAY RECORD")
print("5 EXIT")
choice_T = int(input("ENTER YOUR CHOICE:"))
if choice_T == 1:
adddata_T()
elif choice_T == 2:
updatedata_T()
elif choice_T == 3:
deldata_T()
elif choice_T == 4:
fetchdata_T()
elif choice_T == 5:
print("EXIT")
break
else:
print("WRONG INPUT")

c_T = input("DO YOU WANT TO CONTINUE OR NOT:")


if c_T == 'n' or c_T == 'N':
break

# Library

def adddata_L():
while True:
try:
bid = input("Enter BName of Book:")
author = input("Enter Author of Book:")
price = float(input("Enter the Price of Book:"))
student_id = int(input("enter the roll num of student to whom you want to issue this book : "))
submitted_by_student = bool(int(input("0 if book not submitted else 1 ")))
query = "Insert into library(bname,author,price, student_id, submitted_by_student) values('{}','{}',{}, {}, {} )".format(
bid,
author,
price,
student_id,
submitted_by_student)
cur.execute(query)
con.commit()
print("Values Added..")
ch = input("You want to enter more:")
if ch == 'n' or ch == 'N':
break
except Exception as e:
print(e)

def fetchdata_L():
try:

ch = int(input("Do you want to see all book issue details or specific student : \n 1: Yes \n 2: No \n :"))
if ch == 1:
cur.execute("SELECT*FROM LIBRARY order by updated_at desc")
else:
roll_num = int(input("Enter the roll number of student whose book issue summary you want : "))
cur.execute("SELECT * FROM LIBRARY where student_id = {} order by updated_at desc ".format(roll_num))
results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))
print("Total no. of records:", cur.rowcount)
except:
print("ERROR:UNABLE TO FETCH DATA")

def updatedata_L():
try:
ch = int(input("Do you want to see all book issue details or specific student : \n 1: Yes \n 2: No \n :"))
if ch == 1:
cur.execute("SELECT*FROM LIBRARY order by updated_at desc")
else:
roll_num = int(input("Enter the roll number of student whose book issue summary you want : "))
cur.execute("SELECT * FROM LIBRARY where student_id = {} order by updated_at desc ".format(roll_num))
results = cur.fetchall()
for x in results:
print(f" SNo: {x[0]} \n BName: {x[1]} \n Author : {x[2]} \n Price : {x[3]} \n Student Id : {x[4]}"
f" \n Submitted : {'submitted' if x[5] else 'not submitted'}"
f"\n Issue Date Created : {x[6]} \n Issue Date updated : {x[7]}")

s_no = int(input("enter the serial number you want to update : "))


update = True
choice = int(input("Enter the field you want to update: \n 1: Author \n 2: Price \n 3: submitted_by_student "
" \n 4: Book Name \n "))
if choice == 1:
field = "author"
value = input("Enter the author name : ")
elif choice == 2:
field = "price"
value = int(input("enter the new price for the book : "))
elif choice == 3:
field = "submitted_by_student"
value = bool(int(input(" Enter 0 if book not submitted else 1 ")))
elif choice == 4:
field = "bname"
value = input("Enter the book name : ")
else:
print("bad choice ")
update = False
if update:
if field in ("author", "bname"):
sql = "update library set {} = '{}' where sno = {}".format(field, value, s_no)
else:
sql = "update library set {} = {} where sno = {}".format(field, value, s_no)
cur.execute(sql)
print("Records updated")
con.commit()
except Exception as e:
print(e)

def deldata_L():
name = int(input("Enter the sno you want to delete : "))

cursor = con.cursor()
try:
query = " delete from library where sno = {} ".format(name)
cursor.execute(query)
con.commit()
print(" Deletion Successfull .. ")

except Exception as e:
print(e)

def menu_L():
while True:
print("1 ADD RECORD")
print("2 UPDATE RECORD")
print("3 DELETE RECORD")
print("4 DISPLAY RECORD")
print("5 EXIT")
choice_L = int(input("ENTER YOUR CHOICE:"))
if choice_L == 1:
adddata_L()
elif choice_L == 2:
updatedata_L()
elif choice_L == 3:
deldata_L()
elif choice_L == 4:
fetchdata_L()
elif choice_L == 5:
print("EXIT")
break
else:
print("WRONG INPUT")

c_L = input("DO YOU WANT TO CONTINUE OR NOT:")


if c_L == 'n' or c_L == 'N':
break

# For Fees

def adddata_F():
while True:
try:
sno = int(input("Enter Roll No of Student:"))
schoolfee = float(input("Enter School Fees of Student:"))
busfee = float(input("Enter Bus Fees of Student:"))
fees_paid = bool(int(input("Enter 0 if fees not paid else 1 ")))
query = "Insert into fees(schoolfee,busfee,student_id, fees_paid) values({},{},{},{})".format(schoolfee,
busfee,
sno,
fees_paid)
cur.execute(query)
con.commit()
print("Values Added..")
ch = input("You want to enter more:")
if ch == 'n' or ch == 'N':
break
except Exception as e:
print(e)

def fetchdata_F():
try:

ch = int(input("Do you want to see all fees details or specific student : \n 1: Yes \n 2: No \n :"))
if ch == 1:
cur.execute("SELECT*FROM FEES order by updated_at desc")
else:
roll_num = int(input("Enter the roll number of student whose fees summary you want : "))
cur.execute("SELECT*FROM FEES where student_id={} order by updated_at desc".format(roll_num))
results = cur.fetchall()
print(tabulate(results, headers=[i[0] for i in cur.description], tablefmt='psql'))
print("Total no. of records:", cur.rowcount)
except:
print("ERROR:UNABLE TO FETCH DATA")

def updatedata_F():
roll_no = int(input("Enter the roll number :"))
try:

print("\n Latest fees details for this student id ")


cur.execute("SELECT*FROM FEES where student_id={} order by updated_at desc".format(roll_no))
results = cur.fetchall()
for x in results:
print(f" \n S.No : {x[0]} \n School Fees: {x[1]} \n Bus Fees : {x[2]} \n Student Roll : {x[3]} "
f" \n Fees Paid : {'yes' if x[4] else 'No'} \n Date : {x[6]}")

serial_num = int(input("Enter the serial number (S.NO) you want to update : "))
update = True
choice = int(input("\n Enter the field you want to update \n 1: SchoolFee \n 2: BusFee \n 3: Fees Paid "))
if choice == 1:
field = "schoolfee"
value = int(input("enter the new school fees : "))
elif choice == 2:
field = "busfee"
value = int(input("enter the new bus fees : "))
elif choice == 3:
field = "fees_paid"
value = bool(int(input("enter 0 if fees not paid else 1 : ")))
else:
print("Bad choice")
update = False
if update:
sql = "update fees set {} = {} where sno = {}".format(field, value, serial_num)
cur.execute(sql)
print("Records updated")
con.commit()
except Exception as e:
print(e)

def deldata_F():
name = int(input("Enter the serial num :"))

cursor = con.cursor()
try:
query = " delete from fees where sno ={} ".format(name)
cursor.execute(query)
con.commit()
print(" Deletion Successfull .. ")

except Exception as e:
print(e)

def menu_F():
while True:
print("1 ADD RECORD")
print("2 UPDATE RECORD")
print("3 DELETE RECORD")
print("4 DISPLAY RECORD")
print("5 EXIT")
choice_F = int(input("ENTER YOUR CHOICE:"))
if choice_F == 1:
adddata_F()
elif choice_F == 2:
updatedata_F()
elif choice_F == 3:
deldata_F()
elif choice_F == 4:
fetchdata_F()
elif choice_F == 5:
print("EXIT")
break
else:
print("WRONG INPUT")

c_F = input("DO YOU WANT TO CONTINUE OR NOT:")


if c_F == 'n' or c_F == 'N':
break

while True:
choice_M = input("Enter your choice here:")
while not choice_M:
print(" bad choice ")
choice_M = input("Enter your choice again :")
choice_M = int(choice_M)

create_database()

if choice_M == 1:
menu_S()
elif choice_M == 2:
menu_T()
elif choice_M == 3:
menu_F()
elif choice_M == 4:
menu_L()
elif choice_M == 5:
drop_database()
elif choice_M == 6:
print("You exited from the main menu")
break
else:
print("Please choose correct choice")

re_choice = input("Do you want to run program again (Y/N):")


if re_choice == 'n' or re_choice == 'N':
break

else:
show()

mysql queries
CREATE DATABASE IF NOT EXISTS School_2
USE SCHOOL_2

create table if not exists STUDENT(


ROLLNO INT primary key,
NAME VARCHAR(50),
CLASS VARCHAR(10),
Physics INT not null,
Chemistry INT not null,
Math INT not null,
English INT not null,
Computer INT not null,
tot_percentage decimal(8,3),
tot_marks int not null,
grade varchar(2)
)

create table if not exists TEACHER(


SNO int NOT NULL auto_increment primary key,
NAME VARCHAR(100),
SUB VARCHAR(50),
SALARY INT)

create table if not exists student_teacher (


SNO int NOT NULL auto_increment primary key,
student_id int not null,
teacher_id int not null,
foreign key (student_id) references Student(rollno),
foreign key (teacher_id) references Teacher(SNO)
)

create table if not exists


FEES(
SNO int NOT NULL auto_increment primary key,
SCHOOLFEE INT,
BUSFEE INT,
STUDENT_ID INT,
FEES_PAID bool,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
foreign key (STUDENT_ID) references STUDENT(ROLLNO) )

create table if not exists LIBRARY(


SNO int NOT NULL auto_increment primary key,
BName varchar(50) not null,
AUTHOR VARCHAR(12),
PRICE INT,
student_id int,
submitted_by_student bool,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ,
updated_at DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
foreign key (student_id) references student(rollno)
)

Insert into student(rollno,name,Class,physics, chemistry, math, english, computer, tot_percentage, tot_marks, grade)
values(1,'agam','XII',90, 90, 90, 90, 90, 90.0, 450, 'A2')
update student set name = 'ayan' where rollno = 1
update student set class = 'XI' where rollno = 1
SELECT physics,tot_percentage, tot_marks, grade FROM STUDENT where rollno=1
Output
thankyou

You might also like