forked from Mru-preeti/Edu_Extract-pdfbased-text-extracter-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatabase.py
More file actions
35 lines (29 loc) · 938 Bytes
/
database.py
File metadata and controls
35 lines (29 loc) · 938 Bytes
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
import sqlite3
with sqlite3.connect('Login_data.db') as conn:
cursor = conn.cursor()
# Create USERS table
cursor.execute("""
CREATE TABLE IF NOT EXISTS USERS (
username TEXT NOT NULL,
email_id TEXT PRIMARY KEY,
password TEXT NOT NULL
)
""")
# Insert a user (ignore if exists)
cursor.execute("""
INSERT OR IGNORE INTO USERS (username, email_id, password)
VALUES ('tester', 'tester@gmail.com', 'test')
""")
# Create results table
cursor.execute("""
CREATE TABLE IF NOT EXISTS results (
id INTEGER PRIMARY KEY AUTOINCREMENT,
username TEXT,
quiz_type TEXT,
questions TEXT,
user_answers TEXT,
score INTEGER,
timestamp DATETIME DEFAULT CURRENT_TIMESTAMP,
Correctanswer TEXT
)
""")