-
Notifications
You must be signed in to change notification settings - Fork 0
/
marksheet.py
219 lines (179 loc) · 6.89 KB
/
marksheet.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
import mysql.connector as m
con=m.connect(host="localhost",user="root",password="PleaseEnterYourPassword",database="university")
cur=con.cursor()
def display_marksheet():
q="select*from marksheet"
cur.execute(q)
for i in cur:
print("|Roll N|","| Name |","| Father Name |","| Mother Name |","| DOB |","|G|"," S1"," S2 ","S3"," S4 ","S5"," T ","Per","Grade\n\n")
print("="*120)
print(i)
print("="*120)
con.commit()
def markT():
q="create table marksheet(roll_number bigint primary key,name varchar(20),fname varchar(20),mname varchar(20),email_id varchar(20),dob bigint,gender char,sub1 int,sub2 int,sub3 int,sub4 int,sub5 int,total bigint,per int,grade char)"
cur.execute(q)
print("Table Created")
con.commit
def insert_into_marksheet():
n=int(input("\n\nEnter How many Records you want to insert in Database:\t"))
for i in range(n):
roll_number=int(input("\n\nEnter Student's Roll Numbar:\t"))
name=input("Enter Student's Name:\t")
fname=input("Enter Student's father's Name:\t")
mname=input("Enter Student's mother's Name:\t")
dob=int(input("Enter Student's Date Of Birth:\t"))
gender=input("Enter Student's Gender:\t")
sub1=int(input("Enter Student's Marks:\t"))
sub2=int(input("Enter Student's Marks:\t"))
sub3=int(input("Enter Student's Marks:\t"))
sub4=int(input("Enter Student's Marks:\t"))
sub5=int(input("Enter Student's Marks:\t"))
total=int(input("Enter Student's Total Marks:\t"))
per=int(input("Enter Student's Percentage:\t"))
grade=input("Enter Grade of student:\t")
q="Insert into marksheet values(%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s)"
t=(roll_number,name,fname,mname,dob,gender,sub1,sub2,sub3,sub4,sub5,total,per,grade)
cur.execute(q,t)
print("\n\nData Insert Successfully")
con.commit()
def search_to_marksheet1():
s=input("\n\nEnter Students Name of which you want to see record\t")
q="select*from marksheet where name=%s"
t=(s,)
cur.execute(q,t)
for i in cur:
print("\n\nRoll Number:\t",i[0])
print("Name:\t\t",i[1])
print("Father's Name:\t",i[2])
print("Mother's Name:\t",i[3])
print("Date Of Birth:\t",i[4])
print("Gender:\t\t",i[5])
print("Subject 1:\t",i[6])
print("Subject 2:\t",i[7])
print("Subject 3:\t",i[8])
print("Subject 4:\t",i[9])
print("Subject 5:\t",i[10])
print("Total Marks:\t",i[11])
print("Percentage:\t",i[12],"%")
print("Grade:\t\t",i[13])
print("="*120)
con.commit()
def search_to_marksheet2():
s=input("\n\nEnter Students's Father's Name of which you want to see record\t")
q="select*from marksheet where fname=%s"
t=(s,)
cur.execute(q,t)
for i in cur:
print("\n\nRoll Number:\t",i[0])
print("Name:\t\t",i[1])
print("Father's Name:\t",i[2])
print("Mother's Name:\t",i[3])
print("Date Of Birth:\t",i[4])
print("Gender:\t\t",i[5])
print("Subject 1:\t",i[6])
print("Subject 2:\t",i[7])
print("Subject 3:\t",i[8])
print("Subject 4:\t",i[9])
print("Subject 5:\t",i[10])
print("Total Marks:\t",i[11])
print("Percentage:\t",i[12],"%")
print("Grade:\t\t",i[13])
print("="*120)
con.commit()
def search_to_marksheet3():
s=input("\n\nEnter Students's Mother's Name of which you want to see record\t")
q="select*from marksheet where mname=%s"
t=(s,)
cur.execute(q,t)
for i in cur:
print("\n\nRoll Number:\t",i[0])
print("Name:\t\t",i[1])
print("Father's Name:\t",i[2])
print("Mother's Name:\t",i[3])
print("Date Of Birth:\t",i[4])
print("Gender:\t\t",i[5])
print("Subject 1:\t",i[6])
print("Subject 2:\t",i[7])
print("Subject 3:\t",i[8])
print("Subject 4:\t",i[9])
print("Subject 5:\t",i[10])
print("Total Marks:\t",i[11])
print("Percentage:\t",i[12],"%")
print("Grade:\t\t",i[13])
print("="*120)
con.commit()
def search_to_marksheet4():
s=input("\n\nEnter Roll Number:\t")
q="select*from marksheet where roll_number=%s"
t=(s,)
cur.execute(q,t)
for i in cur:
print("\n\nRoll Number:\t",i[0])
print("Name:\t\t",i[1])
print("Father's Name:\t",i[2])
print("Mother's Name:\t",i[3])
print("Date Of Birth:\t",i[4])
print("Gender:\t\t",i[5])
print("Subject 1:\t",i[6])
print("Subject 2:\t",i[7])
print("Subject 3:\t",i[8])
print("Subject 4:\t",i[9])
print("Subject 5:\t",i[10])
print("Total Marks:\t",i[11])
print("Percentage:\t",i[12],"%")
print("Grade:\t\t",i[13])
print("="*120)
con.commit()
def search_to_marksheet5():
s=input("\n\nEnter Students's Date of Birth of which you want to see record\t")
q="select*from marksheet where dob=%s"
t=(s,)
cur.execute(q,t)
for i in cur:
print("\n\nRoll Number:\t",i[0])
print("Name:\t\t",i[1])
print("Father's Name:\t",i[2])
print("Mother's Name:\t",i[3])
print("Date Of Birth:\t",i[4])
print("Gender:\t\t",i[5])
print("Subject 1:\t",i[6])
print("Subject 2:\t",i[7])
print("Subject 3:\t",i[8])
print("Subject 4:\t",i[9])
print("Subject 5:\t",i[10])
print("Total Marks:\t",i[11])
print("Percentage:\t",i[12],"%")
print("Grade:\t\t",i[13])
print("="*120)
con.commit()
def delete_from_marksheet1():
d=int(input("\n\nEnter Student's Roll Number of which you want to delete record\t"))
q1="select * from marksheet where roll_number=%s"
qu="delete from marksheet where roll_number=%s"
t=(d,)
cur.execute(q1,t)
for i in cur:
print("\n\nRecord Deleted",d)
con.commit()
cur.execute(qu,t)
con.commit()
def delete_from_marksheet2():
d=input("\n\nEnter Student's Name of which you want to delete record\t")
q1="select * from marksheet where name=%s"
qu="delete from marksheet where name=%s"
t=(d,)
cur.execute(q1,t)
for i in cur:
print("\n\nRecord Deleted",d)
con.commit()
cur.execute(qu,t)
con.commit()
def update_in_marksheetDOB():
u1=int(input("\n\nEnter Roll Number in which you want to update?\t"))
u2=int(input("Enter Date of birth you want to update"))
q="update marksheet set dob=%s where roll_number=%s"
t=(u2,u1)
cur.execute(q,t)
con.commit()
print("\n\nData Update Sucessfully")