-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTEST.py
51 lines (40 loc) · 1.15 KB
/
TEST.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
#pikesh was here
import sqlite3 as sql
con = sql.connect('database/database.db')
c = con.cursor()
'''
for row in c.execute("SELECT UID FROM students"):
print(row)
c.execute("UPDATE students SET attendance = ?",('Present',))
'''
#c.execute("UPDATE students SET attendance = ? WHERE UID =?",('No','11615139'))
c.execute("DROP TABLE students")
con.commit()
#for row in c.execute("SELECT * FROM students"):
# print(row)
'''id = 11615139
for row in c.execute("SELECT * FROM students WHERE UID = ?",(str(id),)):
if(str(id) == row[0]):
print(row)
else:
print("1. record doesn't exist")
if(str(id) == c.execute("SELECT UID FROM students WHERE UID = ?",(str(id),))):
for row in c.execute("SELECT * FROM students WHERE UID = ?",(str(id),)):
print(row)
else:
print("2. record doesn't exist")
#c.execute("UPDATE students SET attendance= ? WHERE UID = ?",('Yes',str(id)))
for row in c.execute("SELECT * FROM students WHERE UID = ?",(str(id),)):
print(row)
'''
con.close()
'''
IF EXISTS (SELECT * FROM Products WHERE id = ?)
BEGIN
--do what you need if exists
END
ELSE
BEGIN
--do what needs to be done if not
END
'''