-
Notifications
You must be signed in to change notification settings - Fork 0
/
sql_functions.py
24 lines (18 loc) · 964 Bytes
/
sql_functions.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#This file to be run only for the first time
import sqlite3
conn = sqlite3.connect('participants_db.db')
print("Opened database successfully")
conn.execute('''CREATE TABLE PARTICIPANT_BALANCE
(ID INT PRIMARY KEY NOT NULL,
NAME TEXT NOT NULL,
BALANCE INT NOT NULL);''')
print("Table created successfully")
conn.close()
#Then Insert Elememnts into the database
'''insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (1, 'a', 10000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (2, 'b', 20000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (3, 'c', 30000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (4, 'd', 40000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (5, 'e', 50000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (6, 'f', 60000);
insert into PARTICIPANT_BALANCE (ID, NAME, BALANCE) VALUES (7, 'g', 70000);'''